【问题标题】:Intelligencia.UrlRewriter does not work in IIS8 or IIS Express 8?Intelligencia.UrlRewriter 在 IIS8 或 IIS Express 8 中不起作用?
【发布时间】:2014-10-30 19:15:38
【问题描述】:

我已经在服务器 2012 R2 操作系统上安装了带有更新 3 的新 Visual Studio 2013(这是我用于编程和 SQL 的测试操作系统)

但最近当我使用 IIS Express 编译项目时,我的映射 url 遇到了 404 错误,这些 url 使用的是 Intelligencia.UrlRewriter 最新版本。 错误页面包含:

Requested URL     http://localhost:2706/technology/Astronomy/2014/9/28/1853.html  
Physical Path      E:\project\technology\Astronomy\2014\9\28\1853.html
Logon Method       Anonymous
Logon User     Anonymous
Request Tracing Directory      C:\Users\Administrator\Documents\IISExpress\TraceLogFiles\Project

关于我的项目的更多规范是:

.net 框架:4 托管管道节点:经典(当我将其更改为集成时,什么也没发生!)

我的 web.config 文件如下:

<configSections>
    <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />  
  </configSections>

。 . .

 <httpModules>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
    </httpModules>

。 . .

 <system.webServer>
    <modules>
      <remove name="UrlRewriter"/>
      <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="managedHandler"/>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="managedHandler"/>
    </modules>

。 . .

    <!--Sample-->
 <rewriter>
    <rewrite url="~/up/(.+)/(.+)/(.+)/default.html" to="~/client/default.aspx?u=$1&amp;n=$2&amp;pi=0&amp;ps=5"/>

【问题讨论】:

    标签: asp.net iis urlrewriter


    【解决方案1】:

    我更改了这个设置,现在它可以工作了:

    在我更改的项目属性中
    托管管道节点:经典 -> 到集成


    在 web.config 文件中:

     <system.webServer>
            <validation validateIntegratedModeConfiguration="false" />
            <modules runAllManagedModulesForAllRequests="true" >
              <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" preCondition="managedHandler"/>
              <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="managedHandler"/>
            </modules>
    

    【讨论】:

    • 在我的情况下,url 重写正在主文件夹中工作,但在下一个文件夹中它无法正常工作网站>admin
    猜你喜欢
    • 2020-12-26
    • 2013-03-13
    • 1970-01-01
    • 2011-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-13
    相关资源
    最近更新 更多