IIS6.0环境下测试运行的站点,发布到IIS7.5以后报错,因为是重写了URL,报You can register one in the <compilation><buildProviders>错误
按照报错提示,解决方法重点看下面红色代码,加到相应节点下就OK了
<?xml version="1.0"?> <configuration>
....... ...... ......
<system.web> <customErrors mode="Off"/> <httpModules> <add type="Intelligencia.UrlRewriter.RewriterHttpModule,Intelligencia.UrlRewriter" name="UrlRewriter"/> </httpModules> <compilation debug="true"> <assemblies> <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> <add assembly="System.Drawing.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> </assemblies> <buildProviders > <add extension=".html" type="System.Web.Compilation.PageBuildProvider"/> </buildProviders> </compilation> <!-- 通过 <authentication> 节可以配置 安全身份验证模式,ASP.NET 使用该模式来识别来访用户身份。 --> <!-- 如果在执行请求的过程中出现未处理的错误, 则通过 <customErrors> 节 可以配置相应的处理步骤。具体而言, 开发人员通过该节可配置要显示的 html 错误页, 以代替错误堆栈跟踪。
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> <error statusCode="403" redirect="NoAccess.htm" /> <error statusCode="404" redirect="FileNotFound.htm" /> </customErrors> --> <pages validateRequest="false"> </pages> <httpHandlers> <add path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true" /> <!--<add path="*" verb="*" type="Dottext.Common.UrlManager.UrlReWriteHandlerFactory,Dottext.Common" validate="false" />--> </httpHandlers>
</system.web>
<system.webServer> <handlers> <add name="*.html" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv2.0,bitness32" /> </handlers> </system.webServer> <!-- system.webServer 节是在 Internet Information Services 7.0 下运行 ASP.NET AJAX 所必需的。对早期版本的 IIS 来说则不需要此节。 -->
<rewriter> <rewrite url="~/Page(.[\d]*).html" to="~/com.aspx?id=$1" processing="stop"/> <rewrite url="~/message.html" to="~/book.aspx" processing="stop"/> </rewriter> </configuration>