如何在IIS7上安装asp.net mvc 2?

时间:2021-01-11 03:35:50

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:

我开发了一个ASP.NET MVC 2网站,现在需要将它部署到我的Web服务器上。我已经克服了一些障碍,因为ASP.NET没有安装等等,但我现在已经到了可以提供普通内容文件的地步,如果我尝试点击我的一个MVC URL,我得到这个:

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.

无法加载文件或程序集'System.Web.Mvc,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。该系统找不到指定的文件。

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

不足为奇,因为我没有安装MVC2。问题是,我找不到有关如何安装它的任何好信息!

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

Microsoft下载中心列出了3个文件,其中没有一个看起来很有前途:

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

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

AspNetMVC2_VS2008.exe

AspNetMVC2_VS2008.exe

mvc2-ms-pl.zip

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.

该网站并不打算解释文件的实际内容,但我认为最后一个文件是源代码。无论如何,这就是它的样子。发行说明没有任何帮助,因为它们都是关于在开发机器上安装的,实际上EXE的名称清楚地说明了所有关于Visual Studio集成的内容。

So how do I actually deploy the darn thing?

那么我该如何实际部署darn的东西呢?

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).

另一个与Scott Gu的博客链接的选项是Microsoft Web Platform Installer。现在,我不想安装超过MVC2,我已经安装了IIS等,所以这看起来有点沉重。但这都是学术性的,因为它拒绝在我的服务器上运行,说“你的系统不受支持”或者说是这样的话。 (服务器是Windows Server 2008 Standard SP2,所以我真的不知道它的问题是什么)。

Help!

帮帮我!

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

[荒谬的是,这应该是如此艰难 - 或者根本不是很难,但肯定是一个保密的秘密!]

5 个解决方案

#1


9  

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...

要部署MVC应用程序,您只需确保将引用设置为复制到bin文件夹。具体来说,这些DLL将需要在那里......

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

Note: Copying a reference to your bin folder.

注意:复制对bin文件夹的引用。

In practice, you do this by following these steps:

实际上,您可以按照以下步骤执行此操作:

  1. Right-click on the reference in the "references" section of your project
  2. 右键单击项目“引用”部分中的引用
  3. Select "Properties"
  4. 选择“属性”
  5. Locate the "Copy Local" property and set it to "true"
  6. 找到“复制本地”属性并将其设置为“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.

如果尚未安装.NET 3.5 SP1,则只需要这两个 - 如果没有SP1,则需要包含这两个dll,它们是SP1的一部分,MVC需要进行路由。

#2


5  

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

Darin Dimitrov在这个答案中给出了正确答案(为方便起见,贴在这里):

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

您可以执行不需要安装Visual Studio的服务器安装:

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).

现在你可能会问这个AspNetMVC2.msi来自哪里。实际上你从这里下载AspNetMVC2_VS2008.exe,将.exe重命名为.zip,在里面你会找到你要找的东西(在mvcruntime子文件夹中)。

#3


1  

Copy System.Web.Mvc.dll from your development machine to the application's Bin folder on the web server (or to the GAC).

将System.Web.Mvc.dll从开发计算机复制到Web服务器(或GAC)上的应用程序的Bin文件夹。

This file comes from AspNetMVC2_VS2008.exe.

此文件来自AspNetMVC2_VS2008.exe。

#4


1  

You do not need to put these files in the Server GAC. You can, but you don't need to.

您无需将这些文件放在Server GAC中。你可以,但你不需要。

You can simply copy these files to your /bin directory on the server. In fact, if you have Copy Local set to true when you right click on the reference, it will do just that.

您只需将这些文件复制到服务器上的/ bin目录即可。实际上,如果在右键单击引用时将“复制本地”设置为true,它就会执行此操作。

You need to make sure the reference path to this file:

您需要确保此文件的引用路径:

System.Web.Mvc.dll

System.Web.Mvc.dll程序

is in your /bin directory.

在您的/ bin目录中。

#5


1  

I find running the web platform installer tool works great for getting servers and development machines running. It can be found here... http://www.microsoft.com/web/default.aspx

我发现运行Web平台安装程序工具非常适合运行服务器和开发机器。它可以在这里找到... http://www.microsoft.com/web/default.aspx

#1


9  

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...

要部署MVC应用程序,您只需确保将引用设置为复制到bin文件夹。具体来说,这些DLL将需要在那里......

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

Note: Copying a reference to your bin folder.

注意:复制对bin文件夹的引用。

In practice, you do this by following these steps:

实际上,您可以按照以下步骤执行此操作:

  1. Right-click on the reference in the "references" section of your project
  2. 右键单击项目“引用”部分中的引用
  3. Select "Properties"
  4. 选择“属性”
  5. Locate the "Copy Local" property and set it to "true"
  6. 找到“复制本地”属性并将其设置为“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.

如果尚未安装.NET 3.5 SP1,则只需要这两个 - 如果没有SP1,则需要包含这两个dll,它们是SP1的一部分,MVC需要进行路由。

#2


5  

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

Darin Dimitrov在这个答案中给出了正确答案(为方便起见,贴在这里):

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

您可以执行不需要安装Visual Studio的服务器安装:

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).

现在你可能会问这个AspNetMVC2.msi来自哪里。实际上你从这里下载AspNetMVC2_VS2008.exe,将.exe重命名为.zip,在里面你会找到你要找的东西(在mvcruntime子文件夹中)。

#3


1  

Copy System.Web.Mvc.dll from your development machine to the application's Bin folder on the web server (or to the GAC).

将System.Web.Mvc.dll从开发计算机复制到Web服务器(或GAC)上的应用程序的Bin文件夹。

This file comes from AspNetMVC2_VS2008.exe.

此文件来自AspNetMVC2_VS2008.exe。

#4


1  

You do not need to put these files in the Server GAC. You can, but you don't need to.

您无需将这些文件放在Server GAC中。你可以,但你不需要。

You can simply copy these files to your /bin directory on the server. In fact, if you have Copy Local set to true when you right click on the reference, it will do just that.

您只需将这些文件复制到服务器上的/ bin目录即可。实际上,如果在右键单击引用时将“复制本地”设置为true,它就会执行此操作。

You need to make sure the reference path to this file:

您需要确保此文件的引用路径:

System.Web.Mvc.dll

System.Web.Mvc.dll程序

is in your /bin directory.

在您的/ bin目录中。

#5


1  

I find running the web platform installer tool works great for getting servers and development machines running. It can be found here... http://www.microsoft.com/web/default.aspx

我发现运行Web平台安装程序工具非常适合运行服务器和开发机器。它可以在这里找到... http://www.microsoft.com/web/default.aspx