ASP.NET Application Goes to 500.21 ... until IIS Reset + Clear Tempoary ASP.NET Cache - asp.net

We're seeing an odd pattern in our QA Lab. We have two ASP.NET applications, each deployed on the same Windows 2008 SP2+ box. We have our App Pool running in a Domain Account, and set to never re-cycle. The same 1 App Pool is used by both applications.
After several hours of running fine, new users surfing to a page in our application get the IIS7 Error Page, with a 500.21 error.
If we do nothing but:
1) IISRESET
2) Change folder to c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files and "rd" the 2 applications.
And then surf to our web applications, all is fine.
Then several hours later, however, the 500.21 errors return.
What strikes me as odd is the seeming relationship between clearing the "Temporary ASP.NET Files" folders and the problem going away. I've a practice of clearing the "Temporary ASP.NET Files" folders when installing a new version of our application(s), but not otherwise.
Does this relationship ring familiar to anyone? Is there some new-ish IIS7 feature at work here?
Text of Error:
Server Error in Application "DEFAULT WEB SITE/PAIS"
Internet Information Services 7.0
Error Summary
HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
Detailed Error Information
Module IIS Web Core
Notification ExecuteRequestHandler
Handler PageHandlerFactory-Integrated
Error Code 0x8007000d
Requested URL http://localhost:80/PAIS/Admin.aspx
Physical Path C:\0_Georgia\GA_IS_100142\PortfolioArchiveImageServer\Admin.aspx
Logon Method Anonymous
Logon User Anonymous
Most likely causes:
• ASP.NET is not installed or incompletely installed.
• A configuration typographical error occured.
• Unfavourable pre-condition evaluation exists.
Things you can try:
• If ManagedPipelineHandler is missing, ensure that:
o ManagedEngine is in .
o ManagedPipelineHandler is in , with correct pre-conditions.
• Install ASP.NET.
• Ensure all system.webServer/handlers#modules are in system.webServer/modules#name.
• Review pre-conditions in the and sections.
Links and More Information IIS core does not recognize the module.
View more information »
Thanks in advance,
Howard Hoffman

Faced the same problem and the fix was easy.
1) Open visual studio 2010 command prompt.
2) Run the command aspnet_regiis.exe -i

We found the actual problem, with MS ASP.NET support's help. It's pretty subtle. I think MS has said they will fix the issue in a follow on to the App Fabric release (which is now RTM). Fingers crossed.
The problem consistently occurs in this scenario:
1) ASP.NET web application not yet running. It includes WCF Net.Pipe and / or Net.Tcp bindings. I think the same would occur for NetMsmq but did not try it.
2) An inbound NetPipe or NetTcp WCF Windows Activation Service request is the initial request that starts the App Domain.
3) Application uses an 'Integrated' IIS App Pool (IIS7 or IIS 7.5)
4) The application uses HttpServerUtility.Execute during that 1st request.
It turns out that our application was firing an ASP.NET Health Monitoring event during the very 1st WCF operation -- the very operation that caused Windows Activation Service (WAS) to start our application. Our Health Monitoring configuration includes the TemplatedMailWebEventProvider.
Our application is using an 'Integrated' IIS App Pool.
The TemplatedMailWebEventProvider is implemented to create an email message body as HTML. It uses the System.Web.HttpServerUtility.Execute(string, TextWriter, Boolean) overload.
For this use case that overload does the wrong thing -- it initializes a 'Classic' IIS App Pool based HTTP pipeline. Because that's the wrong pipeline for an 'Integrated' IIS App Pool the pipeline gets corrupted with the next HTTP request -- which is actually the first inbound HTTP request.
So you get the 500.21 error for all future HTTP requests until the application is re-cycled. You don't need to perform the relatively drastic steps of IISRESET, clearing Temporary ASP.NET cache to clear up the error -- just restart the app via saving web.config and avoid the particular startup path that causes the error.
MS suggested a workaround for us -- use the SimpleMailWebEventProvider instead of the TemplatedMailWebEventProvider. That does work, since it takes HttpServerUtility.Execute out of the code path for the first request.
I'd suggested that MS introduce a new web.config <system.web> boolean setting -- UseIntegrated -- that let's the application specify the typeof App Pool to initialize with. Evidently IIS does not forward the App Pool type to ASP.NET, so my sugggestion is a work-around to that.
The TemplatedMailWebEvent provider is much more user friendly than the SimpleMailWebEventProvider, and we do hope MS addresses the issue.
Thanks all for reading,
Howard Hoffman

1. IIS 7 throws an exception as shown in below
2. Open visual studio 2010 command prompt in Administrator mode and execute aspnet_regiis.exe -i
3. Problem fixed, as shown below ASP.Net Application and ASP.Net MCV Application are running smoothly.

The problem more likely is in the application code. The Temporary ASP.NET Files folder contains pre-compiled copies of your app and will be refreshed every time the applications files are accessed. You can pre-compile these files with aspnet_compiler.exe in the \Windows\Microsoft.NET\Framework\v2.0.50727\ folder. Use the -errorstack option allow for more information to be generated about the error you are getting. Long running applications that don't recycle will run into problems if they use a lot of memory or retain large amounts of data in an inproc session state. if your sessions contain large amounts of information, consider using a sqlserver-based session manager.

Related

ASMX call via AJAX returns internal server error

I have a (VB) web site application that calls an ASMX service via an AJAX control (using AjaxControlToolkit) to pre-fill a name search. However, that call always returns an internal server error 500.19 with the error "There is a problem with the resource you are looking for, and it cannot be displayed." All other functionality of the application works. The web site is precompiled and deployed on a two-node Windows 2012 R2/IIS 8.5 cluster. I've tried adding various items to my web.config per other threads, I've deleted the application and recreated it, I've verified database connectivity, I've checked that ASMX handlers exist in the IIS config. Even more befuddling is that this application works in my local Windows 8.1/IIS 8.5 environment and on an IIS 7 test server.
The application runs under an application pool configured for .NET 4.0 and using a pipeline mode of "Integrated." For the sake of testing, I've tried using a 2.0 pool, but then the application doesn't work at all.
The format of the request URL I get an error for is: http://www.example.com/myapplication/EmployeeSearch.asmx/SearchByName
Any ideas what else to look at? Would there be something about the cluster environment causing this issue?
(I know 87,000 people have asked a similar question, but I have yet to find one that solves my issue.)
Update
After stepping away for a bit, I came back to this. I was finally able to get more in-depth error information (500.19), though it's still not elucidating enough. Calling the ASMX is the only part of the app that produces this error. I also did a quick version that just uses jQuery to call the service, and it produced the same result. Per below, the config file path is befuddling to me...why would that be the path it uses?
Module:
IIS Web Core
Notification:
BeginRequest
Handler:
Not yet determined
Error Code:
0x8007010b
Config Error:
Cannot read configuration file
Config File:
\\?\UNC\0.0.0.0\webcontent\www.example.com-iis\my-application\EmployeeSearch.asmx\SearchByName\web.config
Requested URL:
http://www.example.com:80/my-application/EmployeeSearch.asmx/SearchByName
Physical Path
\\0.0.0.0\webcontent\www.example.com-iis\my-application\EmployeeSearch.asmx\SearchByName
Logon Method
Not yet determined
Logon User
Not yet determined
Request Tracing Directory
C:\inetpub\logs\FailedReqLogFiles
The solution, in this case, (after speaking to Microsoft Support) was to set allowSubDirConfig for the application to False.
Now to back up and explain why. This is because of how IIS probes - if set to True or not set at all - for the web.config. It is smart enough to check if a given path/URL (in this case, an ASMX call) is a directory before attempting to retrieve a web.config, but depending on the storage for the application, it may not be able to tell if it is a directory, in which case it defaults to looking for a web.config as if that path is a directory. In my case, we are using a remote NTFS share for storage. Likely the appliance/device or the device driver doesn't support the operation/directory watcher IIS uses to check for the existence of the directory. Setting allowSubDirConfig to False means IIS won't attempt to probe for a web.config file when an ASMX method call is made, which prevents the "Cannot read configuration file" error I was getting.

HTTP Error 503, the service is unavailable

I'm really new to setting up web servers in general. I've got IIS 8 on Windows 8, and I'm trying to set up a little site locally, while doing some development. In IIS I choose Add Site, give a name, points to a location where I have a index.html file (I've tried different locations, latest in a c:\inetpub\wwwroot\test -folder) and otherwise use all default settings. However, when I try to browse to localhost I get
HTTP Error 503. The service is unavailable.
I've verified the pool is started, and I've given IIS_IUSRS Full Control on the target folder
I've search around but not found anything that solved my issue, and there's nothing helpfull in the EventLog or in the C:\Windows\System32\LogFiles\HTTPERR folder
Could anyone tell me what's wrong?
It could be that the user identity is outdated, especially if you've tried starting a stopped app pool and the next request again fails.
In IIS, go to the Application Pools under the Server, then find the correct Application Pool for your web site, and click on it. On the Advanced Settings menu to the right, select Identity and change it and enter new user and password. Click on your Application Pool again, and select Recycle to restart it.
You can also try looking at the error message in Event Viewer, under Windows Logs, Application, Details tab.
Other answers are fine. But in my case, I was working on a Windows box that already was running some old IIS, IISExpress or any other web site. What happened is urls ACLs where reserved somehow in the system. So, you might want to check this.
Here is the console command to dump all URL acls:
netsh http show urlacl
Check what's returned here, and if anything matches the url you are testing, here is the command to delete one URL acl (for example):
netsh http delete urlacl url=http://localhost:2018/
(beware to carefully note what you do here in case it was not related to the original problem)
In my case the problem was the DefaultAppPool. I changed the "Load User Profile" to false and now it works. However, I don't know if there are side effects to this.
Further reading on setting the Load User Profile option: What exactly happens when I set LoadUserProfile of IIS pool?
Check your application's respective Application Framework Pool - it could be stopped. If it is, start it and check again.
If you're still experiencing issues you can also check out Event Viewer to find the cause of that error in order to troubleshoot more.
If the app pool is running under some specific user identity, then go to the advanced settings and update the username and password again to ensure they are correct.
If the app pool immediately stops after you start it and your event log shows:
The worker process for application pool 'APP_POOL_NAME' encountered an
error 'Cannot read configuration file ' trying to read configuration
data from file '\?\', line number '0'. The data field contains
the error code.
... you may experiencing a bug that was apparently introduced in the Windows 10 Fall Creators Update and/or .Net Framework v4.7.1. It can be resolved via the following workaround steps, which are from this answer to the related question Cannot read configuration file ' trying to read configuration data from file '\\?\<EMPTY>', line number '0'.
Go to the drive your IIS is installed on, eg. C:\inetpub\temp\appPools\
Delete the directory (or virtual directory) with the same name as your app pool.
Recycle/Start your app pool again.
I have reported this bug to Microsoft by creating the following issue on the dotnet GitHub repo: After installing 4.7.1, IIS AppPool stops with "Cannot read configuration file".
EDIT
Microsoft responded that this is a known issue with the Windows setup process for the Fall Creators Update and was documented in KB 4050891, Web applications return HTTP Error 503 and WAS event 5189 on Windows 10 Version 1709 (Fall Creators Update). That article provides the following workaround procedure, which is similar to the one above. However, note that it will recycle all app pools regardless of whether they are affected by the issue.
Open a Windows PowerShell window by using the Run as administrator
option.
Run the following commands:
Stop-Service -Force WAS
Remove-Item -Recurse -Force C:\inetpub\temp\appPools\*
Start-Service W3SVC
Or if none of the current solutions work, look in your website's directory for a file called app_offline.htm. That basically tells IIS that your site is unavailable and to show this page instead.
To fix it, either delete it or rename it to app_offline.htm.bak.
In my case, I added it while showing a colleague how to use that to prevent traffic to the site temporarily and then forgot that I did that on my box. Sigh.
Start by looking in Event Viewer, either under the System or the Application log.
In my case the problem was that no worker process could be started for the App Pool because its configuration file couldn't be read - I had included an extra '.' at the end of its name.
I resolved this issue by removing a URL reservation that matched my app directory in IIS. I had a similar (definitely not the same) issue as outlined in this article:
A Not So Common Root Cause for 503 Service Unavailable
It is possible that your domain requires the account used for running the AppPool to have batch logon rights. In which case you will see this same error message. The way you can tell if that is the case, is by looking at the System events in the Event Viewer. There should be an event saying that the account being used with the App Pool has either 'the wrong password or does not have batch logon rights'.
This is why developers quite often use IIS Express on their development machine, since it by passes the batch logon rights issue.
I ran into the same issue, but it was an issue with the actual site settings in IIS.
Select Advanced Settings... for your site/application and then look at the Enabled Protocols value. For whatever reson the value was blank for my site and caused the following error:
HTTP Error 503. The service is unavailable.
The fix was to add in http and select OK. The site was then functional again.
For my case, My Default Application Pool was offline.
To troubleshoot the problem, I checked the IIS logs located in C:\Windows\System32\LogFile\HTTPERR. Scroll down to the most recent error logs, this will show you problems with IIS if any.
My Error was "503 1 AppOffline DefaultPool"
Solution
Open IIS Manager
Click on Application Pools, this lists all application pool to your right.
Check if the application pools hosting your api or site has a stop sign on it. If so, right click the application pool and click start.
Try again to access your service from the client
Check Event Viewer - Windows - Application. If there is a red Error line made from IIS-W3SVC-WP and the message is like The Module DLL C:\Windows\system32\inetsrv\rewrite.dll failed to load. The data is the error. then you are missing some Windows Setup features.
In Windows Server 2012 go to Server Manager, Add Roles and Features, Web Server (IIS) and add the matching feature. Usually, most of the Application Development section is installed. Here is a complete list of IIS features and their associated DLL to help in diagnosis.
After going through a few iterations of that I ended on the error message above regarding "rewrite.dll". This led to a direct download and install of Microsoft URL Rewrite tool. Finally all websites came to life.
Our server ran out of disk space on Sunday afternoon which led to an application suddenly failing and returning HTTP error 502. The logs were empty so it had to be something that was occurring before IIS even did anything.
A swift look at the event viewer(WIN+R > eventvwr) exposed the issue.
It's a good idea to filter out the output of the System and Application windows to WAS since it can get pretty verbose in there.
The application depended on another one which was disabled. Therefore keep in mind an application can go down indirectly if one of it's dependent processes has gone down. We simply re-enabled the .NET application pool and our other application started running normally again.
If you have IIS URL Rewriting installed it could be to do with that. I suffered issues after a Windows 10 Update.
This StackOverflow post helped me.
Go to Windows Control Panel > Programs and Features > IIS URL Rewrite Module 2 > Repair.
i see this error after install url rewrite module i try to install previous version of it from:
https://www.microsoft.com/en-us/download/details.aspx?id=7435
it fixed my error
In my case, the problem was that another application was using the port that I had bound to my web site.
I found it by running the following command from a command line, which lists all of the listening ports and the executable involved:
netstat -b
If you have McAfee HIPS and if you see the following error in event viewer application log:
The Module DLL C:\Windows\System32\inetsrv\HipIISEngineStub.dll failed to load.
The data is the error.
Then this workaround on McAfee.com resolved the issue in my case.
Quote from the page:
Click Start, Run, type explorer and click OK.
Navigate to: %windir%\system32\inetsrv\config
Open the file applicationHost.config as Administrator for editing in Notepad.
Edit the <globalModules> section and remove the following line:
<add name="MfeEngine" image="%windir%\System32\inetsrv\HipIISEngineStub.dll" />
Edit the <modules> section and remove the following line:
<add name="MfeEngine" />
After you have finished editing the applicationHost.config file, save the file, then restart the IIS server using iisreset or by restarting the system.
Actually, in my case https://localhost was working, but http://localhost gave a HTTP 503 Internal server error. Changing the Binding of Default Web Site in IIS to use the hostname localhost instead of a blank host name.
tname for http binding
This could also happen if any recent installs or updates happened with .NET framework and/or ASP.NET. If you are unsure of what happened recently and if all your apps use ASP.NET version 4, you can try reset them by running the following commands in command prompt in administrator mode.
cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319
aspnet_regiis -i
This makes sure to install or reinstall ASP.NET 4 and updates existing applications to use ASP.NET 4 version of the app pool. It updates both IIS Classic and Integrated mode handlers and script mappings in the IIS metabase. It also recreates ASP.NET v4.0 and ASP.NET v4.0 Classic app pools, and sets .NET framework 4 to DefaultAppPool and Classic .NET app pools.
I changed the port from 80 to 8080, that's why this error occur. I write localhost/ in search bar then this error occur. My problem is resolved by writing localhost:8080/ in the search then local host open.
This happened to me on a server on our intranet. After browsing through blog posts and Windows logs, it turned out that a few days before Christmas 2015 (related to a Windows Update?) my web site application pool wanted to create a config file in folder c:\inetpub\temp\appPools, but access to this folder was restricted. This caused the application pool to be disabled.
After adding Full control to Everyone on this temp folder, I restarted the Windows Process Activation Service and everything went online again.
If I'd been a little more elegant, it would probably had been enough to grant the AppPool user full control to the folder, but I never seem to remember how the app pool name and app pool user relates to eachother...
Same thing with IIS Express 10.0 after upgrading Windows 7 to Windows 10.
Solution: go to IIS and enable all disabled websites and reinstall ASP.NET Core.
Also check the address bar and make sure the page is in the right location.
This error can be returned instead of the 404 (Page not found). In my case, it was a bad link on the page that didn't have a subfolder included.
I was having this problem when cleaning up my IIS on dev machine, and I had somehow created a virtual folder for a subfolder of my actual development web that I couldn't clear and was creating conflicts.
To clear it I had to use
C:\Windows\System32\inetsrv\appcmd.exe list vdir
and then individually remove the problem virtual directories using
C:\Windows\System32\inetsrv\appcmd.exe delete app /app.name:"Default Web Site"/{name of virtual directory}
For me the solution is to change Enable 32-bit Applications to False
None of the answers worked for me. So I'd like to share what I found after hours of research..
Keep seeing this message from event logs: The Module DLL C:\Windows\system32\RpcProxy\RpcProxy.dll failed to load. The data is the error. Turns out that dll is 64bit and cannot be loaded into 32bit process.
You can also try the following.
Right-click on the site and 'Basic Settings...'
Click on 'Connect As...'
Click on Specific User and give the new credentials.
Now it should work.
In my case, I had to change my userPass of network because company policies. So, you need to edit your AppPool:
click on Application Pools. Select your pool, 'advanced Settings...' go to 'Process Model' click on 'Identity' and Click on Specific User and give the new credentials.
This might be because of number of connections to the database. I had such a situation and so, wrote a de-constructor and killed db open connection and it resolved.
I had the same problem and found it was caused by permission problems creating the user profile in C:\Users. I gave ApplicationPoolIdentity full permissions to the C:\Users folder, started the site and everything worked, the profile must have been created properly, and my site worked as it should. I then removed access to C:\Users from ApplicationPoolIdentity.
Site wont start on local using ApplicationPoolIdentity, only when using NetworkService: "HTTP Error 503. The service is unavailable."

IIS errors since upgrading to dot net 4

Back in October we upgraded one of our sites (on IIS 6) from .net 3.5 to .net 4.0. Since then we have been getting the following warning and error pretty much everyday:
Warning:
ISAPI
'c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll'
reported itself as unhealthy for the
following reason: 'Deadlock detected'.
Error:
It is not possible to run two
different versions of ASP.NET in the
same IIS process. Please use the IIS
Administration Tool to reconfigure
your server to run the application in
a separate process.
We have checked all applications and ensured that they are running on the correct versions of ASP.NET and also in their own separate app pools.
We have looked at the IIS logs at the time the errors are recorded but this doesn't give any clues as to the issue. Is there a tool available that could give us more information as as to which application is causing the errors and what was happening at the time?
The discussion here might be helpfull for you as well:
You can configure the application pool to orphan the worker process rather than kill it when this condition happens - you can then use adplus to collect a hang dump of the worker process which can be analyzed to figure out what in the process is deadlocked.
(...)
It means that the asp.net thrads have not returned from whatever activity they were doing for a very long time and asp.net has run out of threads - this would normally indicate deadlock. This kb also talks about how to generate dumps for analysis for this condition.
I had the exact same error, and it was due to a .NET 2.0 custom error page that my .NET 4.0 app was referring to.
I had set up a custom error page that was developed in .NET 2.0 and it was applied at the top level of the IIS web site.
The .NET 4.0 application was using a unique MVC URL routing scheme, and for some reason just that application kept locking up and eventually those deadlock errors would come up.
I got rid of the custom error page setting which pointed to the .NET 2.0 web page and switched it back to the default "Not Found" static error. I restarted the application pool and the web page started working without issue.
Hope this helps someone else out there.
http://adamantinewolverine.blogspot.kr/2012/10/running-iis6-in-32-bit-mode-on-64bit.html

Mixing .NET versions between website and virtual directories and the "server application unavailable" error Message

Backstory
Last month our development team created a new asp.net 3.5 application to place out on our production website. Once we had the work completed, we requested from the group that manages are server to copy the app out to our production site, and configure the virtual directory as a new application.
On 12/27/2010, two public 'Gineau Pigs' were selected to use the app, and it worked great.
On 12/30/2010, We received notification by internal staff, that when that staff member tried to access the application (this was the Business Process Owner) they recieved the 'Server Application Unavailable' message.
When I called the group that does our server support, I was told that it probably failed, because I didn't close the connections in my code. However, the same group went in and then created a separate app pool for this Extension Request application. It has had no issues since.
I did a little googling, since I do not like being blamed for things. I found that the 'Server Application Unavailable' message will also appear when you have multiple applications using different frameworks and you do not put them in different application pools.
Technical Details - Tree of our website structure
Main Website <-- ASP Classic
+-Virtual Directory(ExtensionRequest) <-- ASP 3.5
From our server support group:
'Reviewed server logs and website setup in IIS. Had to reset the application pool as it was not working properly. This corrected the website and it is now back online. We went ahead and created a application pool for the extension web so it is isolated from the main site pool. In the past we have seen other application do this when there is a connection being left open and the pool fills up. Would recommend reviewing site code to make sure no connections are being left open.'
The Real Question:
What really caused the failure? Isn't the connection being left open issue an ASP Classic issue? Wouldn't the ExtensionRequest application have to be used (more than twice) in the first place to have the connections left open? Is it more likely the failure is caused by them not bothering to setup the new Application in it's own App Pool in the first place?
Sorry for the long windedness
You'd really need to obtain and review the server's Application & System event and HTTPERR logs for the period the server was reporting these errors.
Without these it'd be hard speculate what was the root cause of the problem.
Update:
OP incorrectly tagged his question so this next section no longer applies. However I'll leave in place because I think the information is useful for those encountering these issues and perhaps thinking about migrating to IIS7.x.
You are correct that running two different .NET Framework's in the same application pool can cause these errors but that's something you'd tend to see on Windows 2003/IIS6, not Windows 2008/IIS7.
IIS7 uses a slightly different approach to specifying which .NET Framework version is loaded and it's determined by the Application pool's managedRunTimeVersion property. When requests are processed by IIS/ASP.NET the site's Handler Mapping's use a preCondition attribute to determine when to load the requisite handler (which is kind of like a script mapping in previous versions of IIS).
This mechanism prevents the incorrect runtime version being loaded into the application pool's worker process.
So if an application pool is configured to run .NET Framework version v4.0 only that version will load, even if your application is built against v2.0.
There's a great article on how this works here:
Achtung! IIS7 Preconditions
The section on Handlers about half way through explains why the dangers of accidentally loading the wrong .NET version into a pool are mitigated by the preCondition feature.
A Server Application Unavailable error usually means something catastrophic has happened (like loading the wrong ASP.NET version's ISAPI filter into an already running worker process).
Not closing SQL connections is unlikely to cause this type of serious error. You'd more than likely be seeing a yellow screen of death runtime errors if that were the case. Running out of SQL connections usually doesn't bend ASP.NET so out of shape that the whole service tops itself.
My prime suspect would be a permissions problem where the application pool identity was unable to correctly access the application folders. But it's just a hunch.
Again, what you need to do is get the Application & System event logs and the HTTPERR logs (they reside in %systemroot%\System32\LogFiles\HTTPERR. That will contain clues and facts about what went wrong.
Update 2:
On Windows 2003/IIS6, if you have two applications running different ASP.NET versions that reside in the same pool you will get this error. In my experience (I work for a web hoster) it is the primary cause of this infamous error page:
There's also a tell-tale event logged to the Application Event log:
Event Type: Error
Event Source: ASP.NET 2.0.50727.0
Event Category: None
Event ID: 1062
Date: 12/01/2011
Time: 12:31:43
User: N/A
Computer: KK-DEBUG
Description:
It is not possible to run two different versions of ASP.NET in the same
IIS process. Please use the IIS Administration Tool to reconfigure your
server to run the application in a separate process.
Whilst your root application may not be written in ASP.NET it's likely that something has triggered loading of a different version of the framework into your site's application pool.
there's a rogue web.config in the root...this will trigger ASP.NET to load
there's a wildcard mapping to ASP.NET 1.1 in the site script maps (less likely, but possible)
I'm inclined to think that your new application most certainly ended up in a pool where other sites or applications were running a different framework version. The only way to really find out is to obtain the Application event logs and look for the event shown above.
It's hard to tell; there could be many causes (too many resources used, calling outside of .NET caused something to crash, etc). I would look in the Event log and see if you can find something there.
If you're running different versions of .NET you definitely want separate pools. If you have the option, I would recommend separate pools for each application (even if in the same .NET version).
As far as "closing the connection" (I assume you mean the connection to the database). If you're creating "low level" connections (i.e. SqlConnection, SqlCommand) then make sure you're wrapping them in a "using" statement, otherwise your connection pool can fill up. In my experience though, you should receive regular .NET errors in this case. If you're using an ORM this shouldn't be an issue.
Edit:
If you can't find anything useful in the Event Log, you could try this: http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis-7/

Application Pools not starting after iisreset

Before I start, I know using iisreset is considered bad practice, but this shouldn't happen anyway..
What we have:
Several machines with IIS6 on Windows Server 2003 R2 (both 64 and 32 bits)
Several WCF webservices (.NET runtime 2.0) deployed in several applications, each with it's own application pool, each application pool running under an other windows account.
What happens:
All appPools are started, all services operational
IISReset is executed (or the machine is rebooted)
IIS comes back up, but not all application pools start properly. Sometimes they all come back up, sometimes one or more pools won't start. They can be started manually however.
Is this "normal" iis behavior and should I just avoid using iisreset, or are we doing something wrong in our .NET code?
The application pools should restart on an iisreset, but they do run outside of iis (in COM+) for reliability. This mean they may may not come back if the application is misbehaving, but IIS and the other apps will(should) come back. So yes, This is "normal".
P.S.
I would also like to "OUT" myself as a proud user of iisreset. Bad practice? Bah! ;D
IIS does not immediately start ASP.NET worker processes (w3wp.exe) until the first request comes in. When you say "not started", does it mean you attempt to access some WCF web services (after iisreset), and you get a Service Unavailable error because the appPool cannot be started? Do you see any IIS W3SVC related entries in the Event logs?
If there are, they may be able to clue you in why they cannot start; post them up here.
Reason:
IIS does not immediately start ASP.NET worker processes (w3wp.exe) until the first request comes in. When it says "not started" it mean you attempt to access some WCF web services (after iisreset) failed due to object was holding some space in memory, and you get a Service Unavailable error because the appPool cannot be started.
Workaround:
Create Batch file with following commands & schedule it.
net stop 23svc
net stop msftpsvc
net stop smtpsvc
net stop PleskControlPanel
net stop HTTPFilter
iisreset /restart
net start w3svc
net start msftpsvc
net start smtpsvc
net start PleskControlPanel
net Start HTTPFilter
Had similiar issue - after IIS has been restarted, DefaultAppPool was stopped.
In application event logs found an error:
Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, or that your network is functioning correctly. If this problem persists, contact your network administrator.
DETAIL - Access is denied.
Fixed by setting in DefaultAppPool Advanced Settings option Load User Profile to False.
Hope it could be usefull.
In a prior support role, I managed several IIS servers running all kinds of .NET mess. When an AppPool failed to start, it was usually a bad login credential.
Re-setting the identity (auth credentials) via advanced settings of the Application pool worked for me.
Earlier I changed my active directory password and as the app pool was already running, it worked fine until I performed IISRESET.

Resources