我在Visual Studio中开发了一个站点,部署到Azure后,第一个登录页面不会填充DataTable。单击任何链接后,所有SQL查询和DataTables&GridView都可以正常工作。
在部署到 Azure 之前,该问题不存在。
首页.aspx内容...
<asp:DataList ID="dlFeatured" runat="server" HorizontalAlign="Center" RepeatColumns="3" RepeatDirection="Horizontal">
<ItemTemplate>
<table style="width:100%; ">
<tr>
<td style="width:250px;">
<asp:Image ID="Image2" style="width:300px; height:300px;" runat="server" ImageUrl='<%# "Images/ProductImages/" + Eval("IMAGE") %>' />
</td>
</tr>
<tr>
<td class="text-center">
<h5 class="text-center" ><strong>
<asp:HyperLink ID="Label1" style="color:#782b42;" runat="server" NavigateUrl='<%# "ProductDetail.aspx?ID="+Eval("ID") %>' Text='<%# Eval("NAME") %>'></asp:HyperLink>
</strong></h5>
</td>
</tr>
<tr>
<td class="text-right">
$<asp:Label ID="Label2" runat="server" Text='<%# Eval("PRICE") %>'></asp:Label>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
代码文件:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["ID"];
dlFeatured.DataSource = DataAccess.selectQuery("SELECT TOP 6 * FROM PRODUCTS WHERE FEATURED = 1 ORDER BY NEWID()");
dlFeatured.DataBind();
}
}
我什至不知道从哪里开始。该网站在 https://wekeafurniture20190329101320.azurewebsites.net
Azure 应用程序服务无法识别 Visual Studio 项目中的"设置为起始页"设置。
我必须访问应用服务资源,单击"应用程序设置",修改默认文档设置。