IIS6重写配置在IIS7中重写无效解决方案
作者:jacky song | 时间:2008-4-13 9:26:54 | 来源:江苏站长网
IIS6重写配置在IIS7中重写无效解决方案 由于IIS6只能在请求被分配到Asp.Net引擎后才能发生重写操作, IIS7可以在 IIS 请求管道的任何地方执行一个HttpModule,
而且IIS7对于文件或文件夹的访问权限得重新设置.
以下是错误信息:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /signin.aspx
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /signin.aspx
如果是IIS7.0的运行环境, 添加该配置
<system.webServer>
<modules>
<!-- 您的自定义IIS重写模块操作-->
<add type="S.Sams.Framework.UrlRewriter.RewriterModule" name="RewriterModule" />
</modules>
</system.webServer>
<modules>
<!-- 您的自定义IIS重写模块操作-->
<add type="S.Sams.Framework.UrlRewriter.RewriterModule" name="RewriterModule" />
</modules>
</system.webServer>
问题即可解决!
摘引自ScottGu的Blog
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<rewriter>
<rewrite url="~/products/(.+)" to="~/products.aspx?category=$1" />
</rewriter>
</configuration>
<configuration>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<rewriter>
<rewrite url="~/products/(.+)" to="~/products.aspx?category=$1" />
</rewriter>
</configuration>
上一篇:算法挑战 36进制条码序列号生成器
下一篇:十天学会ASP.net之第一天

