我正在使用Windows 7(IIS 7.5)并且一直在努力设置使用无扩展网址。这就是我的web.config的样子:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<clear />
<add name="ASPX" path="*.aspx" verb="*" type="" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="4194304" />
<add name="StaticF" path="*.*" verb="FILE, GET" type="" modules="StaticFileModule" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />
<add name="MR" path="*" verb="*" type="" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="4194304" />
</handlers>
</system.webServer>
转到没有扩展名的任何网址会产生404 - 资源无法找到ASP.NET抛出的错误。任何帮助将不胜感激。
答案 0 :(得分:1)
假设您不想要常规网页表单,则可以删除“ASPX”行
至于“*”到MR的映射,您需要在“type”属性中设置另一个处理程序工厂:
<add name="MR" path="*" verb="*"
type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,
Castle.MonoRail.Framework"
modules="ManagedPipelineHandler"
scriptProcessor=""
resourceType="Unspecified"
requireAccess="Script"
allowPathInfo="false"
preCondition=""
responseBufferLimit="4194304" />