在IIS 7.5上托管的ASP.Net MVC 3/4默认处理程序映射 [英] ASP.Net MVC 3/4 Hosted on IIS 7.5 Default Handler Mappings

查看:81
本文介绍了在IIS 7.5上托管的ASP.Net MVC 3/4默认处理程序映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

下面是IIS 7.5中设置的三个处理程序映射"全部不同,并且开发人员未对其进行更改.

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

解决方案

我成功将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>

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

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. inetpub/wwwroot/site

Below are three of the Handler Mappings set in IIS 7.5 all are different and have not been changed by the developers.

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?

解决方案

I successfully deployed MVC 4 to my local IIS 7.5 (windows 7). This fix my problem (as mentioned here)

(For x64 system)

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

(or if you in 32-bit system)

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

Here is my complete Web.config. It has Handler included.

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

这篇关于在IIS 7.5上托管的ASP.Net MVC 3/4默认处理程序映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆