1

我已经让 URLRewriter 完美地在我的 localhot 上工作,但在生产中我得到 404 错误。

我正在使用 IIS 6,从我读到的内容来看,这应该可以正常工作。

这是我的 web.config 中的内容:

<rewriter>
  <rewrite url="~/(\d+)$"       to="~/Items/Details.aspx?ItemId=$1" />
  <rewrite url="~/Items/(\d+)$" to="~/Items/Details.aspx?ItemIId=$1" />
</rewriter>

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


<httpModules>
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>

</httpModules>

有没有人遇到过类似的问题并解决了?

谢谢!

4

2 回答 2

0

这是因为您需要在生产服务器上设置通配符映射。IIS6 仅运行某些文件格式,例如 .aspx 等,但不会将无扩展名 url 映射到 asp.net 管道。

本教程将回答您的问题:

注意:您需要远程桌面访问您的服务器,因此这在共享主机环境中是不可能的,除非您的主机愿意代表您进行设置。

于 2010-11-16T09:32:25.910 回答
0
<rewrite url="~/Items/(\d+)$" to="~/Items/Details.aspx?ItemIdId=$1" />

该 GET 参数是否意味着 ItemId?因为目前它是 ItemIdId。

希望这可以帮助。

于 2009-12-01T04:23:44.937 回答