I have a problem with IIS 7.5 at Windows Server 2008 configuration. I'm hosting an ASP.NET MVC application on separate application pool, configured with AppPoolIdentity and .NET 4.0 Framework.

The application is working normally for some time (few minutes) and after that I'm suddenly experiencing exceptions that looks like connected with IIS resources management. The problem disappears when I change AppPoolIdentity to "real" local system user credentials (local administrator). Maybe app pool recycling makes problems here? But it is configured to recycle every 1740 minutes and it fails sometimes after 5 minutes from its start...

I would like to be able to run the app without special requirements and permissions, as the app is quite simple and shouldn't really need it. I can provide more details if needed. But I must let you know that I don't have any real experience with IIS.

Problem details from application perspective

The application is working normally for some time and suddenly part of controllers start to throw an exception inside StructureMap:

ArgumentNullException: Trying to find an Instance of type [MyType] Parameter name: instance

in StructureMap.InstanceCache.Get(Type pluginType, Instance instance) +376

The type requested was registered correctly (and was resolved properly just a minute before the exception occured). I can't verify it is still registered, as WhatDoIHave diagnostic method throws an exception, too:

NullReferenceException: Object reference not set to an instance of an object. in StructureMap.Diagnostics.WhatDoIHaveWriter.writeInstance(InstanceRef instance) +133

Looks like StructureMap's internal cache gets corrupted somehow.


In IIS, an Application runs within an Application Pool. An Application Pool runs in one or more W3WP processes.

It sounds like what's happening here is that your app eventually encounters a condition that the W3WP can't cope with when run with minimal privileges.

LocalSystem is a high-privileged account - when stuff starts (or in your case, keeps) working as LocalSystem, typically that indicates some form of privilege level difference (occasionally, user profile differences).

All App Pool Identities are magically given membership to IIS_IUSRS by default, which grants all the permissions IIS requires to run an App Pool - this may not include all the permissions required by your particular app/framework/one of the libraries.

Try enabling the Load User Profile setting in the app pool when running low-privileged, and if that doesn't improve things, you'll need to debug it - either watch it running with Process Monitor for possible file or registry access difficulties (http://live.sysinternals.com/procmon.exe), or grab a memory dump of the process when it's failed, grab PSSCOR2, and perhaps start with !dae if nothing looks particularly odd at that point.

The short version is that the internal process / runtime state sounds like it's getting lunched; it shouldn't; often it's going to be some sort of native code issue that does that, but in your case, it could be permissions.

Edit: Oh, not LocalSystem, {local system user like administrator}. Gotcha. Well, give the Profile thing a try - see also this bit.

Also, Recycling: when a new W3WP is started to replace the old one, losing all the state from the old one in the process, and the old one is killed off after 90 seconds if it doesn't complete any useful work it's still capable of, and shut itself down. (read "by default")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.