简体   繁体   English

ASP.Net MVC 3/4托管在IIS 7.5默认处理程序映射上

[英]ASP.Net MVC 3/4 Hosted on IIS 7.5 Default Handler Mappings

What are the correct Default Handler Mappings for ASP.Net, ASP.Net MVC and WCF Services hosted on IIS 7.5 .Net Framework 4.0 on Windows 7 (PRO)? 在Windows 7(PRO)上的IIS 7.5 .Net Framework 4.0上托管的ASP.Net,ASP.Net MVC和WCF服务的正确默认处理程序映射是什么?

Out of a team of 8 developers who installed ASP.Net MVC 3/4 only 1 developer could get a basic ASP.Net MVC 3 Internet application to work under the Default Web Site in IIS 7.5 without changing the Handler Mappings, none of the team could get a second Website with the same site to work with the site sirectory located in a sub directory of the root website. 在安装了ASP.Net MVC 3/4的8位开发人员的团队中,只有1名开发人员可以在IIS 7.5中的默认网站下使用基本的ASP.Net MVC 3 Internet应用程序,而无需更改处理程序映射,没有一个团队可以获得具有相同站点的第二个网站,以使用位于根网站的子目录中的站点目录。 inetpub/wwwroot/site 的Inetpub / wwwroot文件/网站

Below are three of the Handler Mappings set in IIS 7.5 all are different and have not been changed by the developers. 下面是IIS 7.5中设置的三个处理程序映射,它们都是不同的,并且未被开发人员更改。

What is the best way to define the required settings as Defaults and ensure all workstations have the same configurations applied without setting them in the Website Web.Config file? 将所需设置定义为默认值并确保所有工作站都应用相同配置而不在网站Web.Config文件中设置它们的最佳方法是什么?

在此输入图像描述

在此输入图像描述

在此输入图像描述

I successfully deployed MVC 4 to my local IIS 7.5 (windows 7). 我成功地将MVC 4部署到我的本地IIS 7.5(Windows 7)。 This fix my problem (as mentioned here ) 这解决了我的问题(如这里提到的)

(For x64 system) (适用于x64系统)

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

(or if you in 32-bit system) (或者如果你在32位系统中)

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

Also, I changed the DefaultAppPool to use v4-Integrated (from v2-Classic), converted the website to application, and have the application to use DefaultAppPool. 此外,我将DefaultAppPool更改为使用v4-Integrated(来自v2-Classic),将网站转换为应用程序,并让应用程序使用DefaultAppPool。

Here is my complete Web.config. 这是我完整的Web.config。 It has Handler included. 它包含Handler。

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

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. 假设您的默认网站已在IIS中配置为应用程序,此问题的最可能原因是让应用程序池运行Classic管道而不是Integrated管道。 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. 在我们部署到Azure,本地IIS服务器和开发机器的所有MVC应用程序中,我们不必触及处理程序映射,除非必须欺骗 IIS 6来托管MVC站点。

To check for the application pool pipeline: 要检查应用程序池管道:

  1. Open the IIS manager 打开IIS管理器

  2. Right click on the Default Web Site, and choose Advanced Settings. 右键单击“默认网站”,然后选择“高级设置”。 This will open up a window 这将打开一个窗口 在此输入图像描述

  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 现在,关闭此窗口并单击IIS管理器左侧菜单上的“应用程序池” 在此输入图像描述

  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. 如果Managed Pipeline Mode未设置为Integrated(例如,读取经典),则右键单击Application Pool并选择基本设置。 From here, you can change the Pipeline type. 从这里,您可以更改管道类型。 Choose integrated. 选择集成。

在此输入图像描述

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. 5.应用程序池应立即重新启动,但您可以选择手动重新启动它或IIS以确保您的更改已生效。

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. - 如果您运行的是IIS 6,则此处的链接描述如何调整处理程序映射,以便IIS 6可以运行MVC站点。

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. 附录 - 如果您一直在使用处理程序映射,取决于已更改的内容,您可能希望在干净的IIS安装上尝试此操作。 It is not clear what handlers have been misconfigured as your team attempted to make an MVC deployment work. 当您的团队尝试使MVC部署工作时,不清楚哪些处理程序配置错误。

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

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