Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install asp.net mvc 2 on IIS7?

I have developed an ASP.NET MVC 2 website, and now need to deploy it to my web server. I've overcome some hurdles already, since ASP.NET was not installed etc. but I've now got to the point where I can serve up plain content files, and if I try to hit one of my MVC URLs I get this:

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

Not surprising, that, as I've not installed MVC2. Problem is, I can't find any good information about how to install it!

The Microsoft Download Center lists 3 files, none of which look promising:

ASP.NET-MVC-2-RTM-Release-Notes.doc

AspNetMVC2_VS2008.exe

mvc2-ms-pl.zip

The site doesn't bother to explain what the files actually are, but I assume that the last file is the source code. That's what it looks like, anyway. The release notes are no help whatsoever, since they're all about installing on your development machine, and indeed the name of the EXE makes it clear that that's all about Visual Studio integration too.

So how do I actually deploy the darn thing?

The other option linked to from Scott Gu's blog is the Microsoft Web Platform Installer. Now, I don't want to install more than just MVC2, and I already have IIS etc. set up, so this seems a bit heavy. But it's all academic, as it refuses to run on my server, saying "your system is not supported" or words to that effect. (The server is Windows Server 2008 Standard SP2, so I really don't know what it's problem is).

Help!

[It's ridiculous that this should be so hard - or perhaps not hard at all, but certainly a well-kept secret!]

like image 648
Gary McGill Avatar asked Apr 13 '10 11:04

Gary McGill


2 Answers

To deploy an MVC application, you just need to ensure that you set the references up to copy to your bin folder. Specifically, these DLLs will need to be in there...

System.ComponentModel.DataAnnotations.dll
System.Web.Abstractions.dll
System.Web.Mvc.dll
System.Web.Routing.dll

Note: Copying a reference to your bin folder.

In practice, you do this by following these steps:

  1. Right-click on the reference in the "references" section of your project
  2. Select "Properties"
  3. Locate the "Copy Local" property and set it to "true"

PLEASE NOTE!

System.Web.Abstractions.dll
System.Web.Routing.dll

You only need these two if .NET 3.5 SP1 has not been installed - if you don't have SP1, you will need to include these two dlls, which are part of SP1 and are needed by MVC for routing.

like image 101
Fenton Avatar answered Oct 31 '22 05:10

Fenton


The correct answer is given by Darin Dimitrov in this answer (posted here for your convenience):

You could do a server install which doesn't require Visual Studio installed:

msiexec /i AspNetMVC2.msi /l*v .\mvc.log MVC_SERVER_INSTALL="YES"

Now you are probably asking where's this AspNetMVC2.msi coming from. Actually you download AspNetMVC2_VS2008.exe from here, rename the .exe to .zip and inside you'll find what you are looking for (in the mvcruntime sub-folder).

like image 39
Eduardo Molteni Avatar answered Oct 31 '22 07:10

Eduardo Molteni