IIS 7 and Above
Can't view website using a .NET 4.0 AppPool
Last post Aug 12, 2011 07:24 PM by HCamper
Aug 11, 2011 03:55 PM|daveblack|LINK
I'm getting some very obscure errors when I'm trying to view any website (even a trivial one) when I have the site set to use any AppPool running under .NET 4.0 (Classic or Integrated). It happens with the DefaultAppPool as well as any custom as long as
they are running under .NET 4.0. This problem began recently - i.e. it used to work. Unfortunately, I can't remember all of what changed since the problem began - doh!. I'm running Windows 7 Pro x64. I am able to run the website under Cassini VS2010 w/o
I've already tried a couple of things individually (of course a reboot followed each):
Any assistance is greatly appreciated. Here is the error when running my "Hello World" app:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
[NullReferenceException: Object reference not set to an instance of an object.]
System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength) +75
System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler) +405
System.IO.Directory.EnumerateFiles(String path) +103
System.Web.WebPages.Deployment.WebPagesDeployment.AppRootContainsWebPagesFile(String path) +12
System.Web.WebPages.Deployment.PreApplicationStartCode.StartCore(Version testVersion) +46
[InvalidOperationException: The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Object reference not set to an instance of an object..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +11567950
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1167
[HttpException (0x80004005): The pre-application start initialization method Start on type System.Web.WebPages.Deployment.PreApplicationStartCode threw an exception with the following error message: Object reference not set to an instance of an object..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11557040
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4813701
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.431
app pool crashes
Aug 11, 2011 07:06 PM|HCamper|LINK
You do not need to re-install IIS or Net Framework.
Have you checked this
http://learn.iis.net/page.aspx/624/application-pool-identities/ IIS Net guide ?
You can use the "aspnet_regiis.exe tool in the C:\Windows\Microsoft.NET\Framework64\ Framework Version folder
to manage the ASP.NET for IIS Server.
Have you tried using IIS Manager and changing to the "Classic" Application Pool with Net 2.0 Framework ?
You can find the Panel in IIS Manager on the Left hand Side for the Web Site or "Default Web Site".
Aug 11, 2011 07:58 PM|daveblack|LINK
Thanks for your response! I can run any of the websites in any .NET 2.0 AppPool mode. I had also tried re-registering IIS/ASP.NET with "aspnet_regiis.exe for both the x86 and x64 versions for .NET 4.0 (aspnet_regiis.exe from the .NET 4.0 folder).
Aug 11, 2011 08:11 PM|HCamper|LINK
Then read Application Pool Guide
Maybe you have configuration problems ?
The problem maybe be with Visual Studio Project Properties and settings
the "Multi-Target Options"
Not having Visual Studio open from memory settings are
CPU type Amd X64 Intel X86 and for Release or Debug in Configuration Manager.
If your manually moving files you need the files and web.confg.
You then do a compile for each target before Deployment of the Project or files.
You might try Stoppping IIS and Web Publishing then delete the temporary files
for Web Site in the C:\Windows\Microsoft.NET\Framework folders and then it should recompile and maybe work ?
Aug 11, 2011 11:11 PM|daveblack|LINK
I did try deleting all of the Temporary ASP.NET files as well as the Temporary Internet Files from IE. The link above didn't really tell me anything I don't alreay know. The problem is really separate from VisualStudio. I'm running this directly from
the browser (IE9) and the IIS Management Console (i.e. "Browse...").
Why wasn't my metabase deleted when I removed IIS? There must be something else going on here...
Aug 11, 2011 11:34 PM|HCamper|LINK
Ok, Was not sure what you already knew.
If you want a real fresh start of IIS install check this
So your using IE9 that could be part of the issues.
There are some issues with IE9 and Web Sites and Visual Studio.
Check the IE Settings for files to delete and un-do the check box for "preserve web site settings"
change the cache to about 7 days.
Then add your web site to the Intranet and Trusted Zones.
Aug 12, 2011 07:09 PM|daveblack|LINK
Thanks again for all of your suggestions. I'm still not able to get this to work. I've also tried using Firefox 5.0, and directly browsing from the IIS Mgmt Console and still get the same error. Do you know why my IIS metabase wasn't deleted when I removed
IIS in my first attempt at a fix? I thought the metabase was supposed to be stored in a file called Metabase.xml. I found one but it didn't include any of the info directly from my IIS configuration: AppPool names, website names and settings, etc.
Forgot to mention this is Win7 x64 SP1 - so running IIS 7.5
I'm still stumped....
Aug 12, 2011 07:24 PM|HCamper|LINK
The order of install can be an issue. Did you read the previous threads ?
There have been some issues with Windows Service Pack 1 and IIS Server.
The configuration information is in the %windir%\system32\inetsrv\config and end with *.config.
You can open the Application or Admininstration config files and see the settings that are part of the IIS Manager.
When you browse from IIS Managment Console can you change the Application Pool and get a different
kind of error ?