gpt4 book ai didi

c# - asp.net c# SqlDataSource超时问题

转载 作者:太空狗 更新时间:2023-10-29 17:32:52 25 4
gpt4 key购买 nike

我正在尝试将 SqlDataSource 的超时时间延长到 30 秒以上(似乎是默认值)。我正在尝试运行一个必须运行 100,000 条记录的存储过程。在繁忙时段它会超时。我在 2003 服务器上使用 ASP.NET 4.0 和 IIS 6.0。

错误信息:超时已过。在操作完成之前超时期限已过,或者服务器没有响应。

我已经尝试过延长超时时间,但无济于事:

< asp:SqlDataSource ID="dsTest" EnableCaching="true" CacheDuration="604800" runat="server" ConnectionString="<%$ ConnectionStrings:SuperNARIC %>" SelectCommand="selectStatus" SelectCommandType="StoredProcedure" onselecting="dsTest_Selecting" >
<SelectParameters>
< asp:ControlParameter ControlID="ddlCar" Name="CountryID" PropertyName="SelectedValue" Type="Int32" />
< /SelectParameters>
< /asp:SqlDataSource>



protected void dsTest_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandTimeout = 300;
}

如有任何帮助,我们将不胜感激。

谢谢

最佳答案

如前所述here ,这对我有用。

你可以像这样增加超时属性

protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandTimeout = 0;
}

设置timeout为0表示不超时

关于c# - asp.net c# SqlDataSource超时问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10286685/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com