简体   繁体   English

Asp.Net 4.0异步错误

[英]Asp.Net 4.0 Async Errors

I have a website that seems to work perfectly well in development. 我有一个网站,似乎在开发中运作良好。

ScriptManager.GetCurrent(this).AsyncPostBackTimeout = 3600;

One of the pages uses an update panel and a web service (web client). 其中一个页面使用更新面板和Web服务(Web客户端)。 Despite setting the timeout above, I still get the following on the server: 尽管设置了上面的超时,我仍然在服务器上得到以下信息:

at System.Web.HttpContext.Invoke Cancellable Callback(WaitCallback callback, Object state) 
at System.Web.UI.Page.LegacyAsyncPageBeginProcessRequest(HttpContext context, AsyncCallback callback, Object extraData) 
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() 
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I noticed on the aspx page it's set to "async=true" - I don't know why or what it brings to the party in this instance, but I've removed it and the site still works. 我在aspx页面上注意到它设置为“ async = true”-我不知道在这种情况下它为什么或会给聚会带来什么,但是我已经删除了它,并且该站点仍然可以运行。

The page also has a response.redirect with the bool end = false; 该页面还有一个response.redirect,其中bool end = false;

Can anyone enlighten me as to what the async could be there for? 有人可以启发我异步的用途吗? Also any indicators on the error would be appreciated too. 同样,任何关于错误的指标也将不胜感激。

Finally got to the bottom of this - now working perfectly, so here how. 终于深入到此-现在可以正常工作了,所以在这里。

The problem was that I had a long running webservice-although it could be any long running job. 问题是我有一个长时间运行的Web服务,尽管它可能是任何长时间运行的工作。

I added a timeout to my webclient (custom), and because I was using update panels, I also added: 我向我的webclient(自定义)添加了超时,并且由于我使用的是更新面板,所以我还添加了:

ScriptManager.GetCurrent(this).AsyncPostBackTimeout = 600;

However this still wasn't enough. 但是,这还不够。 The key was also put an extended time out on the page request itself: 该键还延长了页面请求本身的超时时间:

Server.ScriptTimeout = 600;

Hope this helps others. 希望这对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM