Web-server – ‘Server Application Unavailable’ in IIS7 after switching to .net 4.0

.net-4.0asp.netautomationiis-7web-server

We recently upgraded to .Net 4.0 and wrote a custom deployment script for our application that uses the Microsoft.Web.Administration library to do things like create websites and setup app pools. We started testing the code on developer boxes and it seemed to work. Then we noticed that if the dev re-built the application it would stop running and IIS7 would give us this (practically useless) error message:

Server Application Unavailable

The web application you are attempting to access on this web
server is currently unavailable.
Please hit the "Refresh" button in
your web browser to retry your
request.

Administrator Note: An error message detailing the cause of this
specific request failure can be found
in the application event log of the
web server. Please review this log
entry to discover what caused this
error to occur.

If we manually recycle the application pool the app will start right back up. We don't see any events or errors in the Application Log. The pool is set to automatically start and recycle on configuration changes.

We have tried every combination of setting in the app pool, application and ASP.net settings. We have tried running the app pool as different user accounts. We have tried deleting the app pool and the application and re-creating both by hand through the UI and the problem still persists.

It's as if using the Microsoft.Web.Administration library poisons the machine so it will never automatically restart app pools again??!!

We would appreciate any insight or debugging advice. We cant run this on any production systems until we understand what caused this to happen.

Best Answer

I found this thread while searching for the exact same error description. And I found what was causing it in my case.

I was converting an application from .net 3.5 to 4.0 and after I changed the app-pool from 2.0 to 4.0 this started. It only happened in classic mode not integrated.

In my case I had wildcard http handlers in web.config:

<add name="Wildcard .net 64 bit" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="bitness64"/>    
<add name="Wildcard .net 32 bit" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="bitness32"/>

But I had forgotten to change the path to the .net 4.0 directory

so after changing \v2.0.50727\aspnet_isapi.dll to \v4.0.30319\aspnet_isapi.dll the website started behaving normally.

Hope this helps someone.