使用IIS应用程序请求路由(ARR)的ASP.NET MVC [英] Using IIS Application Request Routing (ARR) for ASP.NET MVC

查看:171
本文介绍了使用IIS应用程序请求路由(ARR)的ASP.NET MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用一个简单的ASP.NET MVC的Web(使用模板当您创建一个新的站点)和Web将按预期在我的生活环境。

我现在尝试使用IIS应用程序请求路由第2版。我有一个发送匹配规则的所有请求到不同的服务器的规则。

的设置是有点像这样:<一href=\"http://blogs.iis.net/wonyoo/archive/2008/07/09/application-request-routing-arr-as-a-reverse-proxy.aspx\" rel=\"nofollow\">http://blogs.iis.net/wonyoo/archive/2008/07/09/application-request-routing-arr-as-a-reverse-proxy.aspx

我的规则只是一个有点不同,它是/shop(.*)。
只有包含商店请求发送到不同的服务器。我必须使用重写,而不是重定向(同在图片)

这工作只要原来的要求去非ASP.NET MVC的Web。我试图用一个简单的htm文件在webfolder和它的工作。如果把一个编译ASP.NET应用程序到webfolder它的工作。但只要我把一个ASP.NET MVC的Web到该文件夹​​,请求编曲此应用程序提供服务。

我的理解是,Web应用程序得到处理请求的机会之前,应ARR一命呜呼
有没有人使用ARR成功地作为一个ASP.NET MVC的Web反向代理?

修改

下面是进入改写鲁莱时所产生的Web配置。有了这个规则,我得到一个404,表示该规则不被使用。

 &LT;?XML版本=1.0编码=UTF-8&GT?;&LT;结构&gt;  &LT; configSections&GT;
    &LT; sectionGroup NAME =System.Web.Extensions程序TYPE =System.Web.Configuration.SystemWebExtensionsSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35&GT;
      &LT; sectionGroup NAME =脚本TYPE =System.Web.Configuration.ScriptingSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35&GT;
        &lt;节名称=scriptResourceHandlerTYPE =System.Web.Configuration.ScriptingScriptResourceHandlerSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ &GT;
        &LT; sectionGroup名称=Web服务类型=System.Web.Configuration.ScriptingWebServicesSectionGroup,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35&GT;
          &lt;节名称=jsonSerializationTYPE =System.Web.Configuration.ScriptingJsonSerializationSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=无处不在/ &GT;
          &lt;节名称=profileServiceTYPE =System.Web.Configuration.ScriptingProfileServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ &GT;
          &lt;节名称=的AuthenticationServiceTYPE =System.Web.Configuration.ScriptingAuthenticationServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ &GT;
          &lt;节名称=roleServiceTYPE =System.Web.Configuration.ScriptingRoleServiceSection,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假allowDefinition的=MachineToApplication/ &GT;
        &LT; / sectionGroup&GT;
      &LT; / sectionGroup&GT;
    &LT; / sectionGroup&GT;
  &LT; / configSections&GT;  &LT;的appSettings /&GT;  &LT;&是connectionStrings GT;
    &LT;添加名称=ApplicationServices的connectionString =数据源= \\ SQLEX $ P $干燥综合征;集成安全性= SSPI; AttachDBFilename = | DataDirectory目录| ASPNETDB.MDF;用户实例=真的providerName =System.Data.SqlClient的 /&GT;
  &LT; /&是connectionStrings GT;  &LT;&的System.Web GT;    &LT;! -
            集编译调试=true以将调试
            符号插入到编译页。因为这
            影响性能,因此将该值设置为唯一的真
            在开发过程中。
     - &GT;
    &LT;编译调试=假&GT;
      &LT;&集会GT;
        &LT;添加组件=System.Core程序,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
        &LT;添加组件=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Web.Abstractions,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加组件=System.Data.DataSetExtensions,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
        &LT;添加组件=System.Xml.Linq的,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
        &LT;添加组件=System.Data.Linq程序,版本= 3.5.0.0,文化=中性公钥= B77A5C561934E089/&GT;
      &LT; /组件&GT;
    &LT; /编译&GT;    &LT;! -
            在&lt;身份验证和GT;节可以配置
            所使用的安全性的认证模式的
            ASP.NET识别传入的用户。
     - &GT;
    &LT;身份验证模式=表格&GT;
      &LT;形式loginUrl =〜/帐号/登录超时=2880/&GT;
    &LT; /认证&GT;    &LT;会员和GT;
      &LT;供应商&GT;
        &LT;清/&GT;
        &LT;添加名称=AspNetSqlMembershipProviderTYPE =System.Web.Security.SqlMembershipProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a的connectionStringName =ApplicationServicesenablePasswordRetrieval =假enablePasswordReset设置=真正的requiresQuestionAndAnswer =假requiresUniqueEmail =假了passwordFormat =散列maxInvalidPasswordAttempts =5minRequiredPasswordLength =6minRequiredNonalphanumericCharacters =0passwordAttemptWindow =10passwordStrengthRegularEx pression =的applicationName =/ /&GT;
      &LT; /供应商&GT;
    &LT; /会员&GT;    &LT;型材&GT;
      &LT;供应商&GT;
        &LT;清/&GT;
        &LT;添加名称=AspNetSqlProfileProviderTYPE =System.Web.Profile.SqlProfileProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a的connectionStringName =ApplicationServices的applicationName =//&GT;
      &LT; /供应商&GT;
    &LT; / profile文件&GT;    &LT; roleManager启用=false的&GT;
      &LT;供应商&GT;
        &LT;清/&GT;
        &LT;添加的connectionStringName =ApplicationServices的applicationName =/NAME =AspNetSqlRoleProviderTYPE =System.Web.Security.SqlRoleProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/&GT;
        &LT;添加的applicationName =/NAME =AspNetWindowsTokenRoleProviderTYPE =System.Web.Security.WindowsTokenRoleProvider,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/&GT;
      &LT; /供应商&GT;
    &LT; / roleManager&GT;    &LT;! -
            在&lt;&的customErrors GT;节可以配置
            的什么,如果/当发生未处理的错误做
            一个请求的执行过程中。特别,
            它允许开发人员配置HTML错误页
            要显示代替错误堆栈跟踪。        &LT;的customErrors模式=仅限远程的defaultRedirect =GenericErrorPage.htm&GT;
            &LT;错误状态code =403重定向=NoAccess.htm/&GT;
            &LT;错误状态code =404重定向=FileNotFound.htm/&GT;
        &LT; /&的customErrors GT;
     - &GT;    &LT;网页和GT;
      &LT;控制与GT;
        &LT;添加标签preFIX =ASP的命名空间=System.Web.UI程序组件=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
        &LT;添加标签preFIX =ASP的命名空间=System.Web.UI.WebControls集结号=System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT; /控制&GT;      &LT;&命名空间GT;
        &LT;添加命名空间=System.Web.Mvc/&GT;
        &LT;添加命名空间=System.Web.Mvc.Ajax/&GT;
        &LT;添加命名空间=System.Web.Mvc.Html/&GT;
        &LT;添加命名空间=System.Web.Routing/&GT;
        &LT;添加命名空间=System.Linq的/&GT;
        &LT;添加命名空间=System.Collections.Generic/&GT;
      &LT; /命名空间&GT;
    &LT; /页&GT;    &LT;&HttpHandlers的GT;
      &LT;清除动词=*路径=* ASMX。/&GT;
      &LT;添加动词=*路径=*。ASMX验证=假TYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加动词=*路径=* _ AppService.axd验证=假TYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中立,公钥= 31BF3856AD364E35/&GT;
      &LT;添加动词=GET,HEAD路径=的ScriptResource.axdTYPE =System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35验证= 假/&GT;
      &LT;* MVC添加动词=*路径=验证=假TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 1.0.0.0,文化=中性公钥= 31BF3856AD364E35 /&GT;
    &LT; / HttpHandlers的&GT;
    &LT;&的HttpModules GT;
      &LT;添加名称=ScriptModuleTYPE =System.Web.Handlers.ScriptModule,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加名称=UrlRoutingModuleTYPE =System.Web.Routing.UrlRoutingModule,System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
    &LT; /&的HttpModules GT;
  &LT; /system.web>
  &LT;系统codeDOM&GT;
    &LT;编译器&GT;
      &LT;编译语言=C#; CS; CSHARPCS延长= warningLevel =4TYPE =Microsoft.CSharp.CSharp codeProvider,系统,版本= 2.0.0.0,文化=中性公钥= b77a5c561934e089&GT;
        &LT; providerOption NAME =CompilerVersionVALUE =V3.5/&GT;
        &LT; providerOption NAME =warnaserror将值=FALSE/&GT;
      &LT; /编译器&GT;
      &LT;编译语言=VB,VBS,VisualBasic中; VBSCRIPTVB延长= warningLevel =4TYPE =Microsoft.VisualBasic.VB codeProvider,系统,版本= 2.0.0.0,文化=中立,公钥= b77a5c561934e089&GT;
        &LT; providerOption NAME =CompilerVersionVALUE =V3.5/&GT;
        &LT; providerOption NAME =OptionInferVALUE =真/&GT;
        &LT; providerOption NAME =warnaserror将值=FALSE/&GT;
      &LT; /编译器&GT;
    &LT; /编译器&GT;
  &LT; /system.$c$cdom>
  &LT; System.Web.Extensions程序/&GT;
  &LT;! -
        的system.webServer部分需要在Internet上运行ASP.NET AJAX
        信息服务7.0。这是没有必要的IIS的previous版本。
   - &GT;
  &LT; system.webServer&GT;
        &LT;&改写GT;
            &LT;规则与GT;
                &LT;规则名称=店stopProcessing =真&GT;
                    &LT;匹配URL =^店/([_ 0-9A-Z - ] +)/&GT;
                    &lt;作用TYPE =重写URL =article.aspx标题= {R:1}?logRewrittenUrl =真/&GT;
                &LT; /规则&GT;
            &LT; /规则&GT;
        &LT; /重写&GT;
    &LT;验证validateIntegratedModeConfiguration =FALSE/&GT;
    &LT;模块runAllManagedModulesForAllRequests =真正的&GT;
      &LT;清除NAME =ScriptModule/&GT;
      &LT;清除NAME =UrlRoutingModule/&GT;
      &LT;添加名称=ScriptModulepreCondition =managedHandlerTYPE =System.Web.Handlers.ScriptModule,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加名称=UrlRoutingModuleTYPE =System.Web.Routing.UrlRoutingModule,System.Web.Routing,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
    &LT; /模块&gt;
    &LT;&处理GT;
      &LT;清除NAME =WebServiceHandlerFactory集成的/&GT;
      &LT;清除NAME =ScriptHandlerFactory/&GT;
      &LT;清除NAME =ScriptHandlerFactoryAppServices/&GT;
      &LT;清除NAME =ScriptResource/&GT;
      &LT;清除NAME =MvcHttpHandler/&GT;
      &LT;清除NAME =UrlRoutingHandler/&GT;
      &LT;添加名称=ScriptHandlerFactory动词=*PATH = preCondition =integratedModeTYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5* ASMX。 .0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加名称=ScriptHandlerFactoryAppServices动词=*路径=* _ AppService.axdpreCondition =integratedModeTYPE =System.Web.Script.Services.ScriptHandlerFactory,System.Web.Extensions程序,版本= 3.5.0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加名称=ScriptResourcepreCondition =integratedMode动词=GET,HEAD路径=的ScriptResource.axdTYPE =System.Web.Handlers.ScriptResourceHandler,System.Web.Extensions程序,版本= 3.5 .0.0,文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加名称=MvcHttpHandlerpreCondition =integratedMode动词=*路径= TYPE =System.Web.Mvc.MvcHttpHandler,System.Web.Mvc,版本= 1.0.0.0* MVC。文化=中性公钥= 31BF3856AD364E35/&GT;
      &LT;添加名称=UrlRoutingHandlerpreCondition =integratedMode动词=*路径=UrlRouting.axdTYPE =System.Web.HttpForbiddenHandler,System.Web程序,版本= 2.0.0.0,文化=中性公钥= b03f5f7f11d50a3a/&GT;
    &LT; /处理器&GT;
  &LT; /system.webServer>
&LT; /结构&gt;


解决方案

在的Global.asax.cs文件中添加以下路由条目:

  routes.IgnoreRoute(店/ {*} PATHINFO);

这由我解决了这个问题。

看来,MVC路由系统ARR,以集成模式运行时,这是有道理的前踢

I use a simple ASP.NET MVC web (the template you use when you create a new site) and the web works as expected in my live environment.

I now try to use IIS Application Request Routing version 2. I have a rule that send all requests to a different server that match a rule.

The settings are a bit like this: http://blogs.iis.net/wonyoo/archive/2008/07/09/application-request-routing-arr-as-a-reverse-proxy.aspx

My rule is just a bit different it is /shop(.*). Only requests that contain shop are send to a different server. I have to use rewrite, not redirect (The same as in the Picture)

This works as long as the original requests go to a non ASP.NET MVC web. I tried to use a plain htm file in the webfolder and it worked. If put a compiled ASP.NET application into the webfolder it worked. But as soon as I put an ASP.NET MVC web into the folder, request arr served by this application.

My understanding is that the ARR should kick in before the web application gets the chance to handle the request. Did anybody use ARR sucessfully as a reverse proxy for a ASP.NET MVC web?

EDIT

Here is the resulting web config when the rewrite roule is entered. With this rule I get a 404 that indicates that the rule is not used.

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

<configuration>

  <configSections>
    <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
          <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
          <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
        </sectionGroup>
      </sectionGroup>
    </sectionGroup>
  </configSections>

  <appSettings />

  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
  </connectionStrings>

  <system.web>

    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
    -->
    <compilation debug="false">
      <assemblies>
        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
    </compilation>

    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
    -->
    <authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>

    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="/" />
      </providers>
    </membership>

    <profile>
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/" />
      </providers>
    </profile>

    <roleManager enabled="false">
      <providers>
        <clear />
        <add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>
    </roleManager>

    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
    -->

    <pages>
      <controls>
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </controls>

      <namespaces>
        <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.Linq" />
        <add namespace="System.Collections.Generic" />
      </namespaces>
    </pages>

    <httpHandlers>
      <remove verb="*" path="*.asmx" />
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" />
      <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
  </system.web>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <providerOption name="CompilerVersion" value="v3.5" />
        <providerOption name="OptionInfer" value="true" />
        <providerOption name="WarnAsError" value="false" />
      </compiler>
    </compilers>
  </system.codedom>
  <system.web.extensions />
  <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
  -->
  <system.webServer>
        <rewrite>
            <rules>
                <rule name="shop" stopProcessing="true">
                    <match url="^shop/([_0-9a-z-.]+)" />
                    <action type="Rewrite" url="article.aspx?title={R:1}" logRewrittenUrl="true" />
                </rule>
            </rules>
        </rewrite>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="ScriptModule" />
      <remove name="UrlRoutingModule" />
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </modules>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated" />
      <remove name="ScriptHandlerFactory" />
      <remove name="ScriptHandlerFactoryAppServices" />
      <remove name="ScriptResource" />
      <remove name="MvcHttpHandler" />
      <remove name="UrlRoutingHandler" />
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </handlers>
  </system.webServer>
</configuration>

解决方案

In the Global.asax.cs file add the following route entry:

routes.IgnoreRoute("Shop/{*pathInfo}");

This solved by me the problem.

It appears that the MVC routing system kicks in before ARR, which makes sense when running in integrated mode.

这篇关于使用IIS应用程序请求路由(ARR)的ASP.NET MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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