Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to install an MVC3 application on our production server with no luck. The application is from a 3rd party (compiled), and so debugging is not available to me. Besides, I strongly suspect the error occurs before any code in the site has a chance to execute.

Our staging server is - as far as I can determine - set up excactly like the production server. Both run Windows Server 2008 Standard R2, both also run a Sharepoint 2010 site (though this install doesn't touch that in any way). IIS is version 7.5, and .NET Framework 4.0 (required by the MVC app) is (recently) installed (by me, with a reboot after). The application is very small and simple and, as far as I can tell sticks to fairly standard functionality - including forms authentication (ie. it doesnt' pull any dirty tricks).

The error message shown in the browser is very general:

HTTP Error 500.0 - Internal Server Error
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. 

The bit about 'An error message detailing the cause' being in the application event log seems to be just speculation - a pious hope that whatever code actually caused the error will log it. Nothing useful is to be found in the event log (only the very same message, logged by IIS).

Module: AspNetInitClrHostFailureModule 
Notification: BeginRequest 
Handler: StaticFile 
Error Code: 0x80070002 
Requested URL: http://xxxxxx.xxxxxx.xx:80/ 
Physical Path: C:\Xxxxxxx\Prod\WebClient 
Logon Method: Not yet determined 
Logon User: Not yet determined 

Using Failed Request Tracing, I have been able to track the error (as also indicated above) to the AspNetInitClrHostFailureModule:

103. -NOTIFY_MODULE_START 
ModuleName AspNetInitClrHostFailureModule 
Notification 1 
fIsPostNotification false 
Notification BEGIN_REQUEST 

104. -SET_RESPONSE_ERROR_DESCRIPTION 
ErrorDescription 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. 

105. -MODULE_SET_RESPONSE_ERROR_STATUS 
ModuleName AspNetInitClrHostFailureModule 
Notification 1 
HttpStatus 500 
HttpReason Internal Server Error 
HttpSubStatus 0 
ErrorCode 2147942402 
ConfigExceptionInfo  
Notification BEGIN_REQUEST 
ErrorCode The system cannot find the file specified. (0x80070002) 

So there you have it. Seemingly, the AspNetInitClrHostFailureModule fails to find some file. So some questions are:

  1. What is the AspNetInitClrHostFailureModule? It is not listed in the fairly exhausting list of modules configurable in IIS manager for the site. I have had no success googling it either. Maybe it's secret..

  2. I access the root URL of the site. This is supposed to be redirected to /Account/LogOn by the FormsAuthenticationModule. Why then is the handler StaticFile? Is that a clue?

  3. I have tried removing the infamous system.webserver/modules/runAllManagedModulesForAllRequests attribute, and that makes the error go away (but MVC not actually working, of course). I am prepared to specify all necessary modules manually if that's what it takes, but if the AspNetInitClrHostFailureModule is actually needed, I will be just as stuck. Does anyone know, or can anyone direct me to someone who knows, exactly what modules a typical MVC3 application actually needs?

This question might well be a duplicate of this one, but he didn't get any useful answer, and also asked less specific questions. So I'll have my own go.

Hoping for some help here :)

Edit: I have now tried setting up a trivial MVC 3 project on the server. I created a new project using the MVC Application template, compiled it and deployed it to the server. It behaves in exactly the same way. The server simply cannot run MVC 3 projects.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

I would uninstall and reinstall ASP.NET. I've had issues occur after installing the .NET Framework that I do this almost routinely now.

To uninstall:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ua

To reinstall:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

If you need to run 32-bit applications, you would also need to run the aspnet_regiis in the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder. Note that performing the re-installation would affect other ASP.NET web applications if there are any running.

Because the issue occurs so early, it may be useful to enable the .NET Framework Fusion logging. This is designed to provide verbose information about what is occurring during the loading of assemblies.

If all the assemblies are loading ok, I would use Process Monitor to get a trace. That may point you in the right direction for what it was doing at the time of failure.

http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx

If it is an issue of a missing assembly, you can determine what assemblies your application needs by inspecting the manifest. This can be done with ildasm.exe (IL Disassembler) or ILSpy.

I've seen a lot of MVC apps crash at startup with a meaningless error message when introduced on a new server because an assembly (dll) existed in development or test, but not on the new server. If that is the case, it may be one of the following assemblies that need to be copied to the bin folder of the web site:

Microsoft.Web.Infrastructure.dll
System.Net.Http.dll
System.Net.Http.Formatting.dll
System.Net.Http.WebRequest.dll
System.Web.Extensions.dll
System.Web.Helpers.dll
System.Web.Http.dll
System.Web.Http.SelfHost.dll
System.Web.Http.WebHost.dll
System.Web.Mvc.dll
System.Web.Optimization.dll
System.Web.Providers.dll
System.Web.Razor.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll

When you install the ASP.NET MVC msi proper, it usually copies many of those files to a folder in C:\Program Files x86, or under C:\Windows\winsxs somewhere (global assembly cache).

Note that this issue may also occur if the vendor is signing their assemblies, but they are delay-signed. That would also be revealed in the Fusion log. A description of that symptom is here:

http://stackoverflow.com/questions/11030500/assembly-binding-error-bind-result-hr-0x80070002-the-system-cannot-find-the

Delay Signing an Assembly
http://msdn.microsoft.com/en-us/library/t07a3dye.aspx

share|improve this answer
    
Thanks, Greg, for the very informative and useful answer. Although not an aswer to excactly what goes wrong (which was perhaps a vain hope anyway), all your great tips will pull me through, I'm sure. In particular, I hadn't realized (or I'd forgotten) how straightforward it is to reinstall ASP.NET. –  Tor Haugen Sep 26 '12 at 13:08

wild guess :

since it looks like a failed module load, have you checked that the parameters of the application pool linked to your web site are set for the right version of .Net ? The DefaultAppPool is .net v2.0. MVC should probably be in "Integrated" "v4.0" App Pool (default name ASP.NET v4.0).

share|improve this answer
    
Good thinking, and yes I checked that. It's set for .NET v4.0, integrated. –  Tor Haugen Sep 22 '12 at 11:15
    
(and now I upped you for the good thinking too, which I forgot :) –  Tor Haugen Sep 26 '12 at 13:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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