9

在 Windows 7 (PRO) 上托管在 IIS 7.5 .Net Framework 4.0 上的 ASP.Net、ASP.Net MVC 和 WCF 服务的正确默认处理程序映射是什么?

在安装 ASP.Net MVC 3/4 的 8 名开发人员团队中,只有 1 名开发人员可以在 IIS 7.5 的默认网站下运行基本的 ASP.Net MVC 3 Internet 应用程序,而无需更改处理程序映射,团队中没有人可以获得具有相同站点的第二个网站,以使用位于根网站子目录中的站点目录。inetpub/wwwroot/站点

下面是 IIS 7.5 中设置的三个处理程序映射,它们都是不同的,并且没有被开发人员更改。

将所需设置定义为默认值并确保所有工作站应用相同配置而不在网站Web.Config文件中设置它们的最佳方法是什么?

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

4

2 回答 2

5

我成功地将 MVC 4 部署到我的本地 IIS 7.5(Windows 7)。这解决了我的问题(如此所述)

(对于 x64 系统)

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

(或者如果你在 32 位系统中)

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

此外,我将 DefaultAppPool 更改为使用 v4-Integrated(从 v2-Classic),将网站转换为应用程序,并让应用程序使用 DefaultAppPool。

这是我完整的 Web.config。它包括处理程序。

<?xml version="1.0" encoding="utf-8"?>

<compilation targetFramework="4.0" />

<pages>
  <namespaces>
    <add namespace="System.Web.Helpers" />
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Web.WebPages" />
  </namespaces>
</pages>

<modules runAllManagedModulesForAllRequests="true" />

<handlers>
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
  <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
  <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>

于 2013-11-21T15:33:37.337 回答
1

Assuming that your default website has been configured as an application in IIS, the most likely cause of this issue is having the application pool running the Classic pipeline as opposed to the Integrated pipeline. In all of the MVC applications that we have deployed to Azure, local IIS servers and development machines, we have not had to touch the handler mappings unless having to trick IIS 6 into hosting an MVC site.

To check for the application pool pipeline:

  1. Open the IIS manager

  2. Right click on the Default Web Site, and choose Advanced Settings. This will open up a window enter image description here

  3. Note the name of the Application Pool. Now, close this window and click on Application Pools on the left hand menu in IIS manager enter image description here

  4. If the Managed Pipeline Mode is not set to Integrated (eg is reading classic), then right click the Application Pool and select basic settings. From here, you can change the Pipeline type. Choose integrated.

enter image description here

5.The application pool should immediately restart, but you can choose to restart it or IIS manually to ensure that your changes have taken affect.

Note - If you are running IIS 6, here is a link that describes how to adjust the handler mappings so that IIS 6 can run an MVC site.

Addendum - If you have been mucking with the handler mappings, depending on what has been changed, you may want to try this on a clean IIS install. It is not clear what handlers have been misconfigured as your team attempted to make an MVC deployment work.

于 2013-11-15T21:13:19.373 回答