asp.net C#的SqlDataSource timout问题 [英] asp.net c# SqlDataSource timout problems

查看:235
本文介绍了asp.net C#的SqlDataSource timout问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图延长30日以后秒的SqlDataSource的超时(好像是默认值)。我试图运行具有通过记录100,000s运行存储过程。在旺季时超时。我使用的是2003服务器上的ASP.NET 4.0和IIS 6.0。

I'm trying to extend the timeout of an SqlDataSource beyond 30 second (Seems to be the default). I'm trying to run a stored procedure that has to run through 100,000s of records. During busy periods it times out. I'm using ASP.NET 4.0 and IIS 6.0 on 2003 server.

错误消息:
超时已过期。完成操作或服务器之前已超时期间没有响应。

Error Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

我试过无济于事延长超时:

I've tried to no avail to extend the timeout:

< 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;
    }

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

感谢

推荐答案

就像提到这里 ,这为我工作。

Like mentioned here, this worked for me.

您可以增加超时属性类似这样

You can increase the Timeout property like this

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

设置超时时间为0表示没有超时

Setting timeout to 0 means no timeout

这篇关于asp.net C#的SqlDataSource timout问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆