简体   繁体   English

MVC 3部署到IIS6

[英]MVC 3 Deployment to IIS6

Originally, I deployed the site with some of the DLL's set to copy local (as haacked suggested on another SO post). 最初,我使用一些DLL设置部署网站来复制本地(如另一个SO帖子上的haacked建议)。 After this failed, I installed MVC 3 package on the server. 在此失败后,我在服务器上安装了MVC 3软件包。

When I hit my site I get: 当我点击我的网站时,我得到:

Directory Listing Denied This Virtual Directory does not allow contents to be listed. 目录列表被拒绝此虚拟目录不允许列出内容。

I saw haacked's blog , but its almost 3 years old now and some of it just doesn't work anymore. 我看到haacked的博客 ,但现在差不多3岁了,其中一些不再适用了。 Does anyone know what we need to do to get this to work after we installed MVC 3 on the server? 在服务器上安装MVC 3之后,有谁知道我们需要做些什么才能让它工作?

UPDATE UPDATE
I found another link on haacked's blog. 我在haacked的博客上找到了另一个链接 Apparently, this should just work (no need to do wildcard mappings). 显然,这应该工作(不需要做通配符映射)。 My website virtual directory is set to run ASP.NET 4.0.30319, I have installed ASP.NET MVC 3, and I am running IIS6 (windows server 2003 R2, Pretty sure that is IIS6). 我的网站虚拟目录设置为运行ASP.NET 4.0.30319,我已经安装了ASP.NET MVC 3,我正在运行IIS6(Windows Server 2003 R2,非常确定是IIS6)。

The Virtual Directory was set to ASP.NET 4.0. 虚拟目录设置为ASP.NET 4.0。 While, the "Default Web Site" was set to run ASP.NET 2.0. 而“默认网站”设置为运行ASP.NET 2.0。 I changed the "Default Web Site" to run 4.0 in addition to the virt. 除了virt之外,我更改了“默认网站”以运行4.0。 directory and it started working. 目录,它开始工作。 The reason is a mystery to me, but it worked. 原因对我来说是个谜,但它确实奏效了。

It sounds like you haven't set up the wildcard mapping. 听起来你没有设置通配符映射。 You need to configure a mapping in IIS that sends all requests to ASP.NET pipeline for processing. 您需要在IIS中配置映射,将所有请求发送到ASP.NET管道进行处理。 Since you don't have the mapping set up, it interprets the request as a directory browse (which is probably disallowed in your configuration). 由于您没有设置映射,因此它将请求解释为目录浏览(在您的配置中可能不允许)。

From Haacked : 来自Haacked

  1. In the IIS properties for the website, click the Home Directory tab. 在网站的IIS属性中,单击“主目录”选项卡。
  2. Click the "Configuration..." button. 单击“配置...”按钮。 In the "Mappings" tab, click "Insert..." 在“映射”选项卡中,单击“插入...”
  3. Next to the "Wildcard application maps" label In the textbox, type in "c:\\windows\\microsoft.net\\framework\\v2.0.50727\\aspnet_isapi.dll" “通配符应用程序映射”标签旁边的文本框中,键入“c:\\ windows \\ microsoft.net \\ framework \\ v2.0.50727 \\ aspnet_isapi.dll”
  4. Uncheck the box labeled "Verify that file exists" Click OK 取消选中标记为“验证文件是否存在”的框,单击“确定”

I believe ASP.NET 4 Extensionless URL feature is not working for virtual directory on iis v6 unless Default Web Site is also set to run ASP.NET v4.0. 我相信ASP.NET 4无扩展URL功能不适用于iis v6上的虚拟目录,除非默认网站也设置为运行ASP.NET v4.0。 For me, setting ASP.NET v4.0 to Default Web Site is not an option since it's breaking existing v2.0 virtual directory webapps. 对我来说,将ASP.NET v4.0设置为默认网站不是一种选择,因为它破坏了现有的v2.0虚拟目录webapps。 Adding wildcard application maps on mvc3 virtual directory webapp worked for me. 在mvc3虚拟目录webapp上添加通配符应用程序映射对我有用。 Here's the list of steps that I did to deploy mvc onto iis6. 以下是我将mvc部署到iis6上的步骤列表。

  1. ASP.NET v4 is already installed on Windows 2003 server ASP.NET v4已安装在Windows 2003服务器上
  2. Install AspNetMVC3Setup.exe 安装AspNetMVC3Setup.exe
  3. Copy the mvc3 webapp files onto server without mvc3 dlls in the bin folder 将mvc3 webapp文件复制到服务器上,而不在bin文件夹中使用mvc3 dll
  4. Create Virtual Directory pointing to the app folder 创建指向app文件夹的虚拟目录
  5. Set the ASP.NET version to 4.0.30319 将ASP.NET版本设置为4.0.30319
  6. Add Wildcard application map to c:\\windows\\microsoft.net\\framework\\v4.0.30319\\aspnet_isapi.dll and uncheck the Verify that file exists 将通配符应用程序映射添加到c:\\ windows \\ microsoft.net \\ framework \\ v4.0.30319 \\ aspnet_isapi.dll并取消选中验证文件是否存在

ABOUT WILCARD APPLICATION MAP : Be aware that this option causes IIS to intercept every request made against the web server. 关于WILCARD应用程序映射请注意,此选项会导致IIS拦截对Web服务器发出的每个请求。 This includes requests for images, classic ASP pages, and HTML pages. 这包括对图像,经典ASP页面和HTML页面的请求。 Therefore, enabling a wildcard script map to ASP.NET does have performance implications . 因此,启用通配符脚本映射到ASP.NET确实会影响性能

OTHER SOLUTION: In W2K3 SP2 with IIS6, .NET Framework (2, 3.5, 4). 其他解决方案:在带有IIS6的W2K3 SP2中,.NET Framework(2,3.5,4)。

Goto Registry: 转到注册表:

HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\ASP.NET\\4.0.30319.0 HKEY_LOCAL_MACHINE \\ SOFTWARE \\微软\\ ASP.NET \\ 4.0.30319.0

If is necesary create DWORD EnableExtensionlessUrls with value 0 . 如果必要,请创建值为0的 DWORD EnableExtensionlessUrls

Then from command window execute: resetiis 然后从命令窗口执行:resetiis

Create a ASP.NET application from MVC3 Template. 从MVC3模板创建ASP.NET应用程序。

Now in the global.asax setup the routes like theses: 现在在global.asax设置路线,如:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    //routes.MapRoute(
    //    "Default", // Route name
    //    "{controller}.mvc/{action}/{id}", // URL with parameters
    //    new { controller = "Home", action = "Index", id = "" } // Parameter defaults
    //);

    routes.MapRoute(
            "Default",
            "{controller}.aspx/{action}/{id}",
            new { action = "Index", id = "" }
          );

    routes.MapRoute(
      "Root",
      "",
      new { controller = "Home", action = "About", id = "" }
    );
}

Create AppPool for .NET Framework 4 and setup the web application to use this apppool. 为.NET Framework 4创建AppPool并设置Web应用程序以使用此apppool。 You can use the Denis Bauer's ASP.NET Version Switcher or use Aspnet_regiis.exe. 您可以使用Denis Bauer的ASP.NET版本切换器或使用Aspnet_regiis.exe。

RESULT: the browser shows de About page as the default page. 结果:浏览器显示de About页面作为默认页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM