Asp.net mvc 2 在ASP.NET MVC上模拟超时
问题: 我需要创建一个带有超时控制器的web项目 我所做的:Asp.net mvc 2 在ASP.NET MVC上模拟超时,asp.net-mvc-2,Asp.net Mvc 2,问题: 我需要创建一个带有超时控制器的web项目 我所做的: 创建新的web应用程序 清空web.config,并写入以下值: 运行时,服务器休眠3秒钟,然后返回响应,没有任何超时错误。ScriptTimeout值为1 问题: 知道哪里出了问题吗?是否需要408请求超时HTTP状态代码 public ActionResult Index() { return new HttpStatusCodeResult(408); } 只有在元素上的debug=“false”时,才会考虑元素
- 创建新的web应用程序
- 清空web.config,并写入以下值:
知道哪里出了问题吗?是否需要
408请求超时
HTTP状态代码
public ActionResult Index()
{
return new HttpStatusCodeResult(408);
}
只有在
元素上的debug=“false”
时,才会考虑
元素上的executionTimeout
属性
尝试删除调试属性或显式将其设置为false。当然,您必须在不进行调试的情况下运行应用程序才能对其进行测试
有关详细信息,请参阅。不,不太清楚。基于上面的示例,我想创建一个1秒超时页面/站点。
public class DefaultController : Controller
{
public EmptyResult Index()
{
System.Threading.Thread.Sleep(3000);
Response.Write("ScriptTimeout: " + HttpContext.Server.ScriptTimeout);
return new EmptyResult();
}
}
public ActionResult Index()
{
return new HttpStatusCodeResult(408);
}