IIS - Service Unavailable - iis

Recently we are facing "Service Unavailable" while opening our web reports url in internet explorer.
Restarting the IIS service resolves the issue but didn't found any logs/errors in event viewer to track what is causing IIS to fail.
Is there any other way to troubleshoot this?
Many thanks...

To actually help you out SO need more information but following is more common cause.
There is no enough memory for application to run when it try to start. If there are multiple application in your IIS then it cause such issue as other application took priority so memory consume by them.
Your application has some un-handle exception that cause your application to shutdown and sometime it cause worker process to stop.
If your application is .NET based ( This is not the case with you because after IIS restart it runs successfully ) then .NET Runtime Version conflict also create such problem.

Related

Azure Webapp restarted on 1 node, then startup timeout

We have a lightweight .NET Core API running in an Azure Webapp. In the past we had frequent downtime (3 times a week) out of nowhere, because for some reason the Webapp was restarted on 1 node and it couldn't start up in time: 502.5 ASP.NET Core Process Startup Error. First of all there should be no reason not to be able to start within 2 minutes, as it just have a few service registrations and that's it. But secondly, why did restart at all?
One time it was because Microsoft was updating their Azure Storage, which Webapps rely on and causes a restart. So I enabled local caching on the Webapp so that updates on the storage don't affect the webapp. And since then everything was stable for months, until today around 13:00.
Same happened; 1 node went down and the API couldn't start anymore. Just this error message 502.5 ASP.NET Core Process Startup Error. I rebooted the API and it started working again.
I have no idea what to do to prevent this. Does anyone else experience the same issue lately? There is no stacktrace whatsoever, as it looks like it's the runtime that causes the issue and not our code.
Help highly appreciated :)
Regards, Peter

dotnet core IIS website restart on error (for example sql server reboot)

I'm currently facing the following problem when hosting a dotnet core application with IIS.
When the webserver boots before the database server, the dotnet-application throws an error that it is unable to connect to the database. So for so good offcourse.
But the problem is that when it faces this error on startup, it will never again try to connect to the database. The dotnet core application seems to be giving up when facing a startup error.
Is there some general re-try mechanism available to handle these kind of errors? So for example when the application detects a problem, to restart every 5 minutes?
I seem to have found the answer myself. It was during my startup-logic that I already was connecting to the sql database. I could simply force IIS to try to restart the process, until initialization worked out by explicitly shutting down the application using Environment.Exit(-1); whenever an error occured

how to debug iis 7.5 application pool?

I'm having a problem with my IIS 7.5. problem that maybe I have caused yesterday after playing with application pools.
The problem is that website become very slow and the only way to fix it is to recycle the application pool.
When i try to access HTML file it's working fast but when i access classic ASP file it takes long time to load "Waiting for"
When i recycle the pool the problem solved for few seconds or minutes and my question is how do i debug it ? how do i know what cause the application pool to stuck ?
you always have the possibility to debug classic asp applications.
set the debug properties in your iis for your web application like so:
server-side Debugging active: true
then you can use the "stop" keyword in your classic asp files to set a "breakpoint". a popup will be raised to ask you how you want to debug your asp file (e.g.visual Studio)

Application pools won't run

I have two servers sitting behind a loadbalancer in my service tier. Both of them should be identical - IIS setup the same, AppFabric (to keep two services warmed up), app pools running under either a service account or the app pool identity. On one server, everything works. On the other server, three of my app pools (the two that AppFabric is warming up, under the service accounts, and one that's just a standard app pool with no changes made from default settings) stop running almost as soon as I start them up (sometimes on the first request).
I get five of the following error in the Application log each time I try to start one of the app pools:
There was an error during processing of the managed application service auto-start for configuration path: 'MACHINE/WEBROOT/APPHOST/Site/App'. The error message returned is: ''. The worker process will be marked unhealthy and be shutdown. The data field contains the error code.
The error code referenced is 80070005.
This is actually for the same Site/App regardless of the app pool being started (though it may change after recreating the app pools).
In the System log, I get the following warning five times before it errors (Application pool 'AppPool' is being automatically disabled due to a series of failures in the process(es) serving that application pool.):
A process serving application pool 'AppPool' reported a failure during application preloading or service loading. The process id was '2396'. Please ensure that all application preload or service settings in the application pool are configured properly. The data field contains the error number.
The error code referenced is 80004005.
The AppPool here is the one being started.
I've tried recreating; I've tried uninstalling AppFabric (but we need it, so reinstalled and still no go). I'm out of ideas. Any suggestions?
EDIT: I tried copying the applicationHost.config over from the working server, but that didn't work either..
EDIT2: One of the app pools works when running under a real user account but doesn't when running under the ApplicationPoolIdentity....
(Also, we had an issue where the site was running under 2.0 and the apps were running under 4.0. That may have resolved the ones that are running as the service accounts.)
I was just wrestling with this same problem for a few hours and found a different culprit.
I had added a new configuration section to my Web.config in a recent commit. I also added this section to a separate ERB file used by Puppet to generate a custom Web.config at the point of deployment. In this template file, I added the new section but forgot to include its declaration in <configSections>.
Once I added the declaration to the template, our app's test VMs were able to start up again and this error went away.
While the app pools for the applications were 4.0, the app pool for the site itself was 2.0, causing some of the issues. We also had inetpub on a different drive, and we had to grant access to SERVER\Users.

IIS 7.5 how to verify if Auto-Start actually works?

I hosted my asp.net mvc3 application on amazon ec2 cloud using windows server 2008 R2. The first time page loading is very slow. I decided to enable auto start on IIS 7.5.
I followed Scott's post.
http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx
I only have one web application hosted on this server, and this application got its own app pool, not shared with anything else.
this is all I did, add startMode="AlwaysRunning".
here's hte problem. I see performance gets a little bit better, but still about 4-5 seconds.
Is there way to verify if my auto-start setting acutally works?
If you have access to IIS Manager on the box, you can examine "Worker Processes" for the site. Otherwise, look for a process named w3wp.exe. If you only have one site, it should be the only process.
Try stopping the application and confirming the worker process has stopped. Now start the application without issuing a request. If the process is there, auto-start is working.
EDIT: Slides 11 and 12 from http://www.slideshare.net/brianritchie1/iis-alwayson-services may be helpful.

Resources