Recently two days back, for around 15 mins our website was showing this error:
Service Unavailable
HTTP Error 503. The service is unavailable.
I know it might be Application Pool Recycling issue since there is a memory limit on that.
I sent an email to Hosting Support regarding the error and this is what their reply is:
Please note that losing sessions happens whenever the application pool is recycled, and hence all sessionid are dropped. There is limitation of 100 MB memory for the application pools.
While it is understandable as to why set such a limit is set, problem is that limit is very low for .net mvc websites that are poorly coded, since an empty website already needs 30 MB, so as soon as you add database and get traffic, it easy goes above 100
MB, causing the application pool to restart and session is lost having all your visitors logged out.
Ways to optimize your mvc websites to run under 100MB.
SessionState = StateServer By default, .net websites use in-proc session state to keep session information, in-proc sessions are kept in the application pool. So, to avoid depending on the application pool, you can use out-proc session state, to do so set the .NET session state mode
to StateServer inside the section as follows:
If this still doesn't work (session keep reseting), means the StateServer mode still not being used. Then you can try adding a machineKey, you can generate one here:
Please check this from your end and in case you still face issues, please do update us with the exact steps (and links, login credentials if any) to re-create the error. Any snapshots of the error message will be helpful for us in understanding the issue
better.
My website is in WebForms and i am not using sessions for storing anything, i am using Forms Based Authentication and on every user login i am generating a role based Forms Authentication Ticket and using user identity for identification of the user.
I am worried abot one word in this reply i.e poorly coded . I would like to ask what should i check in my website to prevent this type of errors.
You might ask the support if it's your site caused the recycle, if not, they should be responsible for the problem and optimize on their end such as create a dedicated pool for your site.
503's are (usually) generated from the http.sys handler/API before the request get to IIS. Often this can be as simple as the app pool is offline but you will need to see the http.sys and IIS logs to confirm this.
First I would check if the app pool recycling is at the same time as your outages.
You can confirm this by enabling logging for the app pool.
But all this is from an admin point of view. And you might not have access to any of this. I am not sure how much information/knowledge your hoster has.
However an app pool recycle should not cause a 503 as it should spin up a new worker process instantly.
I would ask the hoster what has occuered here when they recylce your app pool. Maybe there policy is that the app/site will be offline be x minutes.
Their answer about the sessions causes 503 is rubbish.
But I would also test locally to see if losing your session will cause a 503. I don't beleive you could ever code a site that way though.
However an app pool recycle should not a 503 as it should spin up a new worker process instantly.
well 15 min outage... can it be a app pool recycle issue ?
Rovastar
would ask the hoster what has occuered here when they recylce your app pool.
actually i have asked from the host and their reply is what i have already mentioned..... the reply was nowhere related to the issue, i dont think they have actually saw the issue before replying
well 15 min outage... can it be a app pool recycle issue ?
A 503 is a service unaviable. A app pool recyle is instant and they overlap (when it is recyled it first spins another one up) so you never see a 503.
Now it could be that your app is slow to start from a cold start. You may see a 503 then. But 15 minutes is crazy.
rajesh saharan
actually i have asked from the host and their reply is what i have already mentioned..... the reply was nowhere related to the issue, i dont think they have actually saw the issue before replying
Thanks
Yes I agree they don't know or understand the issue. You have had a standard reply.
A 503 is a service unaviable. A app pool recyle is instant and they overlap (when it is recyled it first spins another one up) so you never see a 503.
Now it could be that your app is slow to start from a cold start. You may see a 503 then. But 15 minutes is crazy.
So what would be the possible causes for a 15 min service unavailable thing. Will the host be able to tell this only or can i do from my end to find the problem.
It seems like either some files in "C:/windows/Microsoft.net/Framework64/v4.0.30319/" folder or I removed them myself (VS sometimes complains on files in "ASP.NET Temporary files" and their deletion helps)... Probably I didn't pay attention that those folder
not a temporary...
P.P.S.
In this case, why VS complained on files in "C:/windows/Microsoft.net/Framework64/v4.0.30319/" folder... ok, now it's hard to say.
rajesh sahar...
Member
225 Points
553 Posts
HTTP Error 503 ... How to avoid it ?
Nov 05, 2012 04:03 AM|LINK
Hi,
Recently two days back, for around 15 mins our website was showing this error:
Service Unavailable
HTTP Error 503. The service is unavailable.
I know it might be Application Pool Recycling issue since there is a memory limit on that.
I sent an email to Hosting Support regarding the error and this is what their reply is:
Please note that losing sessions happens whenever the application pool is recycled, and hence all sessionid are dropped. There is limitation of 100 MB memory for the application pools.
While it is understandable as to why set such a limit is set, problem is that limit is very low for .net mvc websites that are poorly coded, since an empty website already needs 30 MB, so as soon as you add database and get traffic, it easy goes above 100 MB, causing the application pool to restart and session is lost having all your visitors logged out.
Ways to optimize your mvc websites to run under 100MB.
SessionState = StateServer
By default, .net websites use in-proc session state to keep session information, in-proc sessions are kept in the application pool. So, to avoid depending on the application pool, you can use out-proc session state, to do so set the .NET session state mode to StateServer inside the section as follows:
---
http://pastebin.com/a4nzkTTy
---
If this still doesn't work (session keep reseting), means the StateServer mode still not being used. Then you can try adding a machineKey, you can generate one here:
---
http://pastebin.com/Hs8cXRC9
---
Please check this from your end and in case you still face issues, please do update us with the exact steps (and links, login credentials if any) to re-create the error. Any snapshots of the error message will be helpful for us in understanding the issue better.
My website is in WebForms and i am not using sessions for storing anything, i am using Forms Based Authentication and on every user login i am generating a role based Forms Authentication Ticket and using user identity for identification of the user.
I am worried abot one word in this reply i.e poorly coded . I would like to ask what should i check in my website to prevent this type of errors.
Thanks
Topspy
Contributor
3775 Points
806 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 05, 2012 07:45 AM|LINK
You might ask the support if it's your site caused the recycle, if not, they should be responsible for the problem and optimize on their end such as create a dedicated pool for your site.
Asp.net Hosting | Windows Hosting | SQL Server Hosting
rajesh sahar...
Member
225 Points
553 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 05, 2012 08:33 AM|LINK
Ho do i know that whether i have a shared pool or dedicated pool. In my plesk panel it shows like this:
IIS Application Pool domain)(4.0)(pool)
Maximum cpu use: 25
My website is hosted on a shared hosting server.
Thanks
Rovastar
Member
182 Points
59 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 08, 2012 09:21 AM|LINK
503's are (usually) generated from the http.sys handler/API before the request get to IIS. Often this can be as simple as the app pool is offline but you will need to see the http.sys and IIS logs to confirm this.
First I would check if the app pool recycling is at the same time as your outages.
You can confirm this by enabling logging for the app pool.
But all this is from an admin point of view. And you might not have access to any of this. I am not sure how much information/knowledge your hoster has.
However an app pool recycle should not cause a 503 as it should spin up a new worker process instantly.
I would ask the hoster what has occuered here when they recylce your app pool. Maybe there policy is that the app/site will be offline be x minutes.
Their answer about the sessions causes 503 is rubbish.
But I would also test locally to see if losing your session will cause a 503. I don't beleive you could ever code a site that way though.
rajesh sahar...
Member
225 Points
553 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 08, 2012 09:38 AM|LINK
well 15 min outage... can it be a app pool recycle issue ?
actually i have asked from the host and their reply is what i have already mentioned..... the reply was nowhere related to the issue, i dont think they have actually saw the issue before replying
Thanks
Rovastar
Member
182 Points
59 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 08, 2012 05:39 PM|LINK
A 503 is a service unaviable. A app pool recyle is instant and they overlap (when it is recyled it first spins another one up) so you never see a 503.
Now it could be that your app is slow to start from a cold start. You may see a 503 then. But 15 minutes is crazy.
Yes I agree they don't know or understand the issue. You have had a standard reply.
rajesh sahar...
Member
225 Points
553 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 09, 2012 07:50 AM|LINK
So what would be the possible causes for a 15 min service unavailable thing. Will the host be able to tell this only or can i do from my end to find the problem.
RameshRajend...
Star
7983 Points
2099 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 09, 2012 07:53 AM|LINK
I've reinstalled .NET 64 - that helped.
P.S.
It seems like either some files in "C:/windows/Microsoft.net/Framework64/v4.0.30319/" folder or I removed them myself (VS sometimes complains on files in "ASP.NET Temporary files" and their deletion helps)... Probably I didn't pay attention that those folder not a temporary...
P.P.S.
In this case, why VS complained on files in "C:/windows/Microsoft.net/Framework64/v4.0.30319/" folder... ok, now it's hard to say.
Rovastar
Member
182 Points
59 Posts
Re: HTTP Error 503 ... How to avoid it ?
Nov 09, 2012 01:32 PM|LINK
There are no way to tell apart from at the hoster level.