更新时间:2022-04-03 03:27:40
您需要在web.config中的XML文件的请求映射到 TransferRequestHandler
。否则,IIS将处理请求。
You need to map requests for your XML files to TransferRequestHandler
in web.config. Otherwise IIS will handle the request.
乔恩·加洛韦解释如何做到这一点这里。
Jon Galloway explains how to do this here.
总之,你在你的web.config添加此元素的位置/ system.webServer /处理器:
In summary, you add this element to location/system.webServer/handlers in your web.config:
<add name="XmlFileHandler" path="*.xml" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />