Reputation: 431
I have an MVC4 Application deployed on my IIS server and the issue that i'm facing is, when i leave my application idle for 20min and perform my login post service call it is returning me 403 forbidden error,but the next subsequent service call succeeds.here is my code
LoginController:
FormsAuthentication.SetAuthCookie(Result.UserName, false);
return Json(new { url = Url.Action("Index", "Home") });
web.config:
<authentication mode="Forms">
<forms loginUrl="~/login/Login" timeout="20" />
</authentication>
Is there any setting related To IIS that i need to change? B.T.W The idle timeout settings for my application pool is 20 min..
Regards
Upvotes: 1
Views: 1606
Reputation: 763
IIS7 shuts down the application when it receives no requests for a certain length of time.
There are two ways that you can handle this.
Modify the "Idle Timeout" value within the application pool. By default it will shutdown the application if there are no requests for 20 minutes
If you are using ASP.NET 4.0 you can use the new Auto-Start behavior to keep the app "Always Running" you can see this http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx post for examples on how to configure it.
Upvotes: 1