[英]URLRewriter for IIS 7 returns 404 Server Error
I've implemented " Approach 3: Using an HttpModule to Perform Extension-Less URL Rewriting with IIS7 " from here: - http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx 我已经实现了“ 方法3:使用HttpModule从IIS7执行无扩展URL重写 ”: - http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url -rewriting-与-ASP-net.aspx
That is based on URLRewriter module: - http://urlrewriter.net/ 这是基于URLRewriter模块: - http://urlrewriter.net/
It seems to work on my local environment but on production server (running IIS 7) it shows " 404 - File or directory not found " page. 它似乎适用于我的本地环境,但在生产服务器(运行IIS 7)上它显示“ 404 - 文件或目录未找到 ”页面。
I've searched on Google and could not seem to find the solution. 我在Google上搜索过,似乎无法找到解决方案。
In the end, we went back to IIS 6 and followed the instructions here which worked: - http://urlrewriter.net/index.php/support/installation/windows-server-2003 最后,我们回到IIS 6并按照此处的说明进行操作: - http://urlrewriter.net/index.php/support/installation/windows-server-2003
But someday we may have to upgrade to IIS 7 on a shared hosting environment and the same issue will appear again! 但是有一天我们可能不得不在共享托管环境中升级到IIS 7,同样的问题将再次出现!
The hosting dude got it to work in IIS 7. The HTTP handlers requires wildcard mapping with different application pool to make it work in IIS 7. Hope this helps. 托管伙伴让它在IIS 7中工作.HTTP处理程序需要使用不同应用程序池的通配符映射,以使其在IIS 7中工作。希望这会有所帮助。
Make sure you have the following in Web.Config : 确保在Web.Config中包含以下内容:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
<add name="wildcard" path="*" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
</handlers>
</system.webServer>
I had a similar issue that my page p1 (has been rewritten, originally is p1.aspx) was mistakenly regarded as p1 directory. 我有一个类似的问题,我的页面p1(已被重写,最初是p1.aspx)被错误地视为p1目录。
I added <modules runAllManagedModulesForAllRequests="true" /> to the <system.webServer> in the web.config and it seems begin to work. 我将<modules runAllManagedModulesForAllRequests =“true”/>添加到web.config中的<system.webServer>,它似乎开始工作。
For IIS 7 对于IIS 7
Copy the HttpModules definition in your web.config file from system.web to system.webServer 将web.config文件中的HttpModules定义从system.web复制到system.webServer
<system.webServer>
<modules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</modules>
<system.webServer>
Application Pools: Managed Pipiline Mode = Integrated 应用程序池:托管Pipiline模式=集成
My colleague had the same problem and I check that he sets the app pool to use the Classic Pipeline instead of using the Integrated Pipeline which he should use and changing this to Integrated solved the problem. 我的同事遇到了同样的问题,我检查他是否将应用程序池设置为使用Classic Pipeline而不是使用他应该使用的Integrated Pipeline,并将其更改为Integrated解决了问题。 Maybe this could solve yours as well?
也许这可以解决你的问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.