当我在Web应用程序中运行查询时,我得到一个null值.SQL Management Studio中直接相同的查询返回结果.
我认为问题是暂停.如何在Web应用程序中增加执行查询的时间?在我的web.config:中connectionstring,没有超时代码.如果我在那里选择超时,会影响我系统的其他部分吗?
如何将CommandTimeout添加到web.config中的连接字符串?
我试过了:
<add name="ConnectionString" connectionString="Data Source=;Initial Catalog=;Persist Security Info=True;User ID=sa;Password=sa@123;Connect Timeout=200" providerName="System.Data.SqlClient"/>
</connectionStrings>
Run Code Online (Sandbox Code Playgroud)
还有这个:
<add name="MyProject.ConnectionString"
connectionString="Data Source=127.0.0.1;Initial Catalog=MyDB;Persist Security Info=True;CommandTimeout=60;User ID=sa;Password=saPassw0rd"
providerName="System.Data.SqlClient" />
Run Code Online (Sandbox Code Playgroud)
但它并没有为我工作.
谢谢
我得到了错误
超时已过。操作完成前超时时间已过或服务器未响应。
命令执行期间。
我也在Connect Timeout=60连接字符串中设置。
该存储过程执行时间约为 35 秒。
连接已建立,但不返回结果。