Automatic IIS reset when we have a 503 error - asp.net

My website written with asp.net gives 503 error several times a week for unknown reasons and my website users suddenly encounter this error, we are investigating the reasons, but before that we are looking for a solution to The dedicated IIS section can be restarted automatically, is there a solution in this regard?
The goal is to do this reset automatically before users want to let us know that the website has encountered an error
Thanks a lot

The 503 error is probably a problem with the app pool, the app pool suddenly stops or the process is killed. If you can be sure there is no problem with the app pool, you can just restart the application pool without restarting IIS.
If you want to restart IIS, you can use Task scheduler.
Open task scheduler in Control panel, create basic task wizard in right-hand action.
Enter a name and next.
Choose the trigger and next.
Choose start a program and next.
Choose iisreset.exe and next.
Finish.

Related

How to properly autostart an asp.net application in IIS10

I'm trying to get my ASP.NET application to automatically start whenever the application pool is running.
As per the lots and lots of references online I have already done the following:
Set the Application Pool to StartMode=AlwaysRunning
Set the site in question (that belongs to beforementioned Pool) to preloadEnabled=true
Install the Application Initialization feature to the Windows installation
Add the <applicationInitialization> node to the web.config's <system.webServer> node
The web application is based on Owin and has a simple log4net logging statement in it's Startup.Configuration() method. Now when restarting IIS I see that the w3svc.exe process is running, so I know the StartMode=AlwaysRunning is working. There are however no logging messages in the log file.
Navigating to any url (even a nonexisting one) in the application will start the app and add the log line.
Because of the actual work that's done in the startup of the application I really want the application to truly preload, but I seem to be unable to get it done.
Searching this site I have unfortunately not been able to find a solution.
Thanks in advance.
To answer my own question for future generations, it seems I was on the right track. To get the application to start in IIS10 (and I assume in IIS 8 as well) you only need the following three steps:
Set the Application Pool to StartMode=AlwaysRunning to make sure the w3svc.exe process is always running for the App Pool.
Set the site in question (that belongs to beforementioned Pool) to preloadEnabled=true
Install the Application Initialization feature to the Windows installation as per the instructions here.
One important thing to note is that if the Application Initialization task was not previously installed on the machine you must reboot the machine. This is what I missed the last time which led to quite some time wasted looking for other things :(
Anyway, setting up those three things will cause the app to actually go through it's initialization, which is especially useful if you want to setup some scheduling task (ea using the Quartz NuGet package).
Note by the way that if you setup auto initialization like above, the application will also automatically start after the shutdown timeout has expired and on application pool recycles.

Debugging kills Apppool

I have an application which worked fine until yesterday.
Today I cannot run the application using F5. I receive an error "Unable to start ASP.NET Debugging".
When this message appears, the app-pool is stopped. No matter how often I restart the app-pool, debugging stops it again.
I DID NOT change one line of code. But what I did was changing my windows-(domain-user)password.
I already rebooted.
Any clue? Any logfile where I might look at?
Is the application pool running as your domain account? Did you update the password in the application pool as well?
Have you checked the Event Viewer to see why the application pool isn't starting?

IIS application pool crashes several times a day

I have an application that has a application pool that shuts down a couple of times a day and I can't figure out why. the website is hosted on a VM with SQL Server R2. the version of IIS is 7 and the website has a dedicated application pool using .NET framework v4.0.30319.
At the application level the website is using a target framework of 4.5 and seems to run just fine for a 24-48 hour period and then for some reason the application pool just stops. We do have other .NET 4.5 applications running on this machine and their application pools do not have this problem. The only thing slightly different about this application is that we initiate a separate thread to send a order confirmation email when an order is completed. We average about a couple of hundred orders a day for this website.
According to the event log the error reported prior to the shutdown is
"A process serving application pool 'RetailSupport' suffered a fatal communication error with the Windows Process Activation Service"
Please help
I would check, if your code could hit under some circumstances an endless loop or a recursive
call of methods. This is often the reason for this error.
What always helps me in such cases is to add debug logs (e.g. log4net) in your case especially before the email is sent, status info about resources, etc. They can be more informative then the IIS logs.
If this does not help, check http://support.microsoft.com/kb/919789/en how to use the debug Diagnostic tool, to get more details for the error.
Look also for IIS: Web Application hangs periodically needs system reboot it could help you.
Also: what recycle strategy on IIS do you have?

IIS Recycling too often

We run a .NET 1.1 application on W2k3 server. The app pool is configured to recycle at 512MB. However, a week ago it started to recycle every 2 minutes. Since we run a web farm, the anonymous user we run IIS with is a domain account.
About a week ago, that user account expired, and we have to re-enable it. Could that have caused any problems? Maybe that user lost some permissions, or was left out of the IIS_WPG group.
Any advice will be greatly appreciated.
Try finding out more info by Logging ASP.NET Application Shutdown Events
Look in the server's Event Log. That may hold the answer.
If after checking the logs and all the standard "App Pool Health" settings (the obvious), I would look for other processes that might be mucking around with your web.config file (check the timestamp on it), which of course causes the app to restart.
I was once at a customer site and we couldn't figure out why our app kept restarting (and dropping all session state, etc...) Turned out it was a broken "Auto-Encrypt All Web.Config Files" little script that they had scheduled to run every 5 minutes. Problem was it never properly detected that it successfully had encrypted the file, so it just kept rewriting every 5 minutes... sigh..

How to diagnose IIS fatal communication error problem

I've a a customer using IIS and an application, developed by us, in ASP.NET 1.1.
Monday, for 4 times in a row the following error has appeared:
A process serving application pool 'xxxx' suffered a fatal communication error with the World Wide Web Publishing Service. The process id was 'yyyy'. The data field contains the error number.
Any idea about how to diagnose this? The only link I've found talks about installing low level debug tools but before proceeding in this kind of low level analysis I would know if someone has a better idea or a suitable alternative.
The problem (from what I can see) is something in the customer environment, because the same application it's installed at other customer sites on at least 20 or 30 different servers and the problem do not happen.
Had the same issue on IIS 7, had few reports all worked except one report that was very long and it never worked on IIS7 (it was fine on low spec server).
on IIS7 in application pool's Advance Setting I set "Enable 32-Bit Application" to true and all worked nicely
I'm getting the same error, here are some more details:
running: Windows Server 2003, IIS 6.0 / ASP 3.0,
2.13 GHz, 1 GB ram
My web site is in Beta, so I hardly have any visitors to the site.
According to the event viewer I'm getting this warning 3 times every 3 minutes,
then it stops for a few hours.
Then sometimes I get the error:
A process serving application pool 'DefaultAppPool' terminated unexpectedly. The process id was '3900'. The process exit code was '0x800703e9'.
which follow by:
Application pool 'DefaultAppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.
Which then causes a 'Service Unavailable' message when browsing to the website.
after reading too many post about this issue, I did the following steps:
I read that it might be registry access right, so I installed a monitor and trace all the W3SVC Access Denied errors and grant permition
I read that the 0x800703e9 error means stack over flow which causes a w3wp.exe crash and I should install a Debug tool and try to get a memory dump.
I did that but I didn't get any dump, so I installed a new debugging tool, but didn't got a crash yet.
My web site is doing some data mining which keeps the server busy.
Conclusion:
I don't know what is going on there... but I do know that my server machine is way to slow on resource, so I'm going to upgrade and reinstall it, I'm certain that it will solve the problem...
The problem happens all the time, even when my .net code is idle, therefore it is a problem in the server, and not in my code.
I think that the first warnning “A process serving application pool ..." happens every some time, and every now and then it causes the Application Pool to restart, therefore a attaching a debugger doesn't help - the process keeps restarting and the debugger is not effective any longer...
I think that the 0x800703e9 error (which causes the Service Unavailable) maybe happens when the app pool restart, I guess that it needs a lot of resource and since my machine is too slow it gets the 0x800703e9 ... as said before this is a stack over flow, but I think that it is caused by low resource and not by an endless recursion.
I think that the 'registry access right' which is claimed by Microsoft to be the issue, is nonsense, but I didn't got 'Service Unavailable' since so it might helped (thought I still get the warnning “A process serving application pool ..." ).
Hope this help someone...
I'm sure you already know this, but the App Pool contains 1.1 applications only right? I don't remember the error you get when the pool dies by trying to mix frameworks (something like Server Unavailable), but it's more common then I thought in the wild so I would double check.
While not likely the case, it's somewhere to start.
Edit: This KB article also had the error message you described relating to registry permissions, what version of IIS is the client running?
I had this same problem when a website was deployed to a client's web server. This Microsoft support article says:
"This issue may occur if the NT AUTHORITY\NETWORK SERVICE account does not have the permissions to the required registry keys."
And the resolution is: "set the permissions to the required registry keys, and then restart IIS 6.0."
The linked article has the steps for doing this.
One more popular reason (as in my case) - one of windows logs is full.

Resources