Getting ASP.NET MVC 3 working on

On May 25, 2011, in How-to, Technical, by Frank Cheung

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 Responses to “Getting ASP.NET MVC 3 working on”

  1. Dean says:

    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. Michael says:

    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. Dean says:

    Windows 2008. Actually, it just goes to the directory listing.

  4. Tyson Benson says:

    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’

  5. Michael says:

    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.

  6. […] You can also use Deployable Dependencies. Posted on February 13, 2011 at 2:41 am by admin · Permalink In: Code · Tagged […]

  7. Duncan Gallimore says:

    Fantastic. Thought I’d wasted my time on this MVC stuff. You’ve saved my bacon – thanks.

  8. Daniel Bailiff says:

    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.

  9. Hyatt Baker says:

    Just what I needed to get my site up!

  10. Ernesto says:

    Oh!! That’s Great!! It works perfectly!! thank you so much!

  11. Danielle says:

    Hello! Will you please update your resources to include support for VS 2013? These directions are for VS 2010.


Leave a Reply

iBlog by PageLines