我努力使以下IIS规则正确地充当反向代理:
<rule name="not working rule" stopProcessing="true">
<match url="^test" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:5000/Home/Index" />
</rule>
当我导航到site.com/test时,显示404错误。但是,如果我尝试以下规则:
<rule name="not working rule" stopProcessing="true">
<match url="^test.x" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:5000/Home/Index" />
</rule>
它在导航到site.com/test.x时确实起作用,因此重写似乎仅在使用无扩展名的url时才起作用,这使我相信它必须与IIS的application-proxy-part一起做一些事情。 / p>
我的web.config其余部分为默认设置:
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>