asp.net - Azure Web 应用程序中的 4 分钟超时

标签 asp.net asp.net-mvc-4 azure bigdata iis-8

我的项目是 ASP.NET MVC 4 项目。

在本地主机中,当我在 Azure 中托管它时,它工作正常 我在超过 4 分钟的 ajax 调用中遇到超时。 我确信问题出在 azure 上,因为我在服务器中做什么并不重要。 即使只是设置 Thread.sleep(300000) 我也会超时。

我读到: https://azure.microsoft.com/en-us/blog/new-configurable-idle-timeout-for-azure-load-balancer/

a common practice to keep the connection active for a longer period is to use TCP Keep-alive

网络应用程序没有其他选择。 所以我想我需要的是帮助保持 asp.net 中的代码活跃。 我自己无法弄清楚这一点。 尝试每隔一分钟向服务器发送一次简单的 ajax 调用,但这对我没有帮助 所以我尝试像这样使用 TcpKeepAlive:

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

没用,我需要帮助!!

最佳答案

关于asp.net - Azure Web 应用程序中的 4 分钟超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33449600/

相关文章:

asp.net-mvc - 需要帮助了解 Moq 如何解决实际查询

c# - 将现有用户从 MVC 4 SimpleMembership 迁移到 MVC 5 ASP.NET Identity

Azure 存储错误 : "The specified blob already exists", 但事实并非如此!

c# - 如何以编程方式在 EPiServer 10 中将页面设置为 "translate"

c# - 如何编写高效的 sql 查询以从多个表中进行选择?

C# 有更好的写法吗?

asp.net - 使用 Microsoft.Owin.Testing.TestServer 进行身份验证以进行内存中集成测试

c# - 路由配置不起作用

c# - 在现有应用程序中添加 Azure AD 身份验证

设置应用程序设置后,Azure Functions 应用程序产生错误