Azure的4分钟超时在Web应用程序 [英] Azure 4 min timeout in web app
问题描述
我的项目是一个ASP.NET MVC 4项目。
My project is an ASP.NET MVC 4 project.
而当我在Azure中承载它在本地主机正常工作
我得到在拿4分多钟的Ajax调用超时。
我相信这个问题是因为蔚蓝不要紧我在服务器正在做。
甚至只是设置视频下载(300000)
我收到了超时。
While in localhost it works fine when I host it in Azure
I get a timeout in ajax calls that take more than 4 minutes.
I am sure that the problem is with azure because it doesn't matter what I'm doing in the server.
even just set Thread.sleep(300000)
I get a timeout.
我读:
的https://azure.microsoft.com/en-us/blog/new-configurable-idle-timeout-for-azure-load-balancer/
这
通常的做法是保持连接活跃一段较长的时间是
使用TCP保持活动
a common practice to keep the connection active for a longer period is to use TCP Keep-alive
和存在的web应用程序没有其他选择。
所以我想,我需要的是帮助,以永葆code在asp.net中。
我不能用自己摸不着头脑。
试图发送每隔一分钟简单的Ajax调用服务器,这并不能帮助我
所以我试图用TCPKEEPALIVE这样的:
and there is no other option for web apps. So I guess that what I need is help to keep alive code in asp.net. I can't figure this out by myself. tried to send every one minute simple ajax call to the server and this doesn't help me so I tried to use TcpKeepAlive like this:
public JsonResult MyLongOperation()
{
HttpWebRequest request =(HttpWebRequest)WebRequest.Create("mySite");
request.Proxy = null;
request.ServicePoint.SetTcpKeepAlive(true, 30000, 5000);
Thread.Sleep(300000);//5 min sleep
return Json("ok",JsonRequestBehavior.AllowGet);
}
没有工作,我需要帮助请!
Didn't work,i need help please!!
推荐答案
你试过request.KeepAlive = TRUE; ?
Have you tried request.KeepAlive=true; ?
这篇关于Azure的4分钟超时在Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!