Aug 9, 2011

IIS 7 can’t run ASP.NET MVC application due to missing System.Web.Helpers


I’ve set up IIS 7 on my Windows 2008 R2 server according to this guide and deployed my ASP.NET MVC application on it via the one-click publishing method in Visual Studio 2010, but the IIS server fails to run the application due to a configuration error:

Parser Error Message: Could not load file or assembly ‘System.Web.Helpers, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

How do I fix this?


Apparently I need to install MVC dependencies on the server. I found a recipe on winhost forums, which says to add the required references to your project and configure them for web deployment. I followed these steps, and it solved my problem:

  1. Add the following references to the project:

    • Microsoft.Web.Infrastructure
    • System.Web.Razor
    • System.Web.WebPages.Razor
    • System.Web.WebPages.Deployment
  2. Set the property Copy Local to True for the following references:

    • System.Web.Helpers
    • System.Web.MVC
    • System.Web.WebPages
    • Microsoft.Web.Infrastructure
    • System.Web.Razor
    • System.Web.WebPages.Razor
    • System.Web.WebPages.Deployment
  3. Re-deploy


ITHedgeHog made me aware of a shortcut in Visual Studio 2010 for the above procedure:
Right click on the project and click Add Deployable Dependencies, you will then get a dialog in which you can simply pick ASP.NET MVC.

Related posts:

  1. Load-Balanced IIS 7.5 Web Server ASP.NET Session State problem
  2. Port used for ASP.NET application
  3. How to distribute ASP.NET app on lightweight hardware (such as NAS)?
  4. What hosted server configuration do I need to consider for a medium-performance web-application?
  5. PHP + IIS Application Pool Identity WindowsTemp permissions

Leave a comment