问题描述
带有点的网址会生成服务器错误404(例如 www.mysite.com/a.b )。一种解决方案是使用新的查找特定路径标准的处理程序来编辑我网站的HTTP处理程序。如果请求匹配,则将其正确发送到.NET进行处理。该处理程序如下所示。
<add name="ApiURIs-ISAPI-Integrated-4.0"
path="*"
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
因为我使用path =“ *”,所以所有.css或.js之类的静态文件都会失败并被阻止。我的静态文件在/ Content目录中。有没有办法从中排除目录?
解决方法
尝试在要删除处理程序的目录中添加以下web.config文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="ApiURIs-ISAPI-Integrated-4.0" />
</handlers>
</system.webServer>
</configuration>
进行更改后刷新网站。