Getting ASP.NET MVC 3 working on

Getting Errors After Deploying your Application?

After deploying your application, you might see the following error message…

Could not load file or assembly ‘System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35′ or one of its dependencies. The system cannot find the file specified.

This is due to the MVC binaries not being installed in the GAC on the server. But do not fret, the GAC is optional for MVC 3! To get your application to work properly, the necessary DLLs must be published to the application’s bin directory.  Visual Studio 2010 provides a simple way to deploy the needed dlls.  Here’s how:

1) Right click on your project and click on “Add Deployable Dependencies”.  You should see the following dialog box:

2) Depending on your project, click the appropriate dependency.  Once you click OK, you should see a new folder, _bin_deployableAssemblies in your project tree.

3) Deploy your application as you normally would and Visual Studio 2010 will now deploy all the listed DLLs onto the server.

Note that you can also use the same method to deploy SQL CE 4.0 dlls.

14 thoughts on “Getting ASP.NET MVC 3 working on

  1. I created the vanilla MVC 3 project in VS2010 just to test on my discountasp site and it’s not working. I’m not sure if Default Documents have anything to do with it. Using Index.htm, I get the site’s folder listing. Turning off directory browsing throws an error that directory listing is turned off, of course.

    My global.asax is deployed, as are the required dll’s to the \bin folder.

    Any help would be appreciated!


  2. Can you describe what you are seeing or the error message that you are getting? Is your account running under Windows 2003 or Windows 2008?

  3. So is it by choice that you deliberately do not install the MVC DLL’s in your server’s GAC? it seems a terribly inconvenient configuration, especially for a hosting company that claims to support MVC. If there is a valid reason for not having the DLL’S in the GAC then you should make this article easier to find. Like having the MVC icon on your home page link to an article saying ‘how to get started with MVC on’

  4. This is really a system administration decision more than an issue related to MVC. Unlike MVC 2, Microsoft hasn’t put out an .exe installer for MVC 3. The only options would be to manually use WPI or manually upload the .dll’s to the GAC.

    In short we are very methodical when it comes to things like this. Considering MVC is bin deployable by design, the concerns about manual/random installation, the amount of interest from customers, etc, its has not been installed yet.

    Having said that, I can promise you we revisit this issue weekly.

  5. This was very helpful. However, I didn’t find this article via your support site, but had to Google it. This needs to be posted somewhere prominent for people trying to use MVC 3.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.