从头开始...<location>
似乎正常。不过,您都需要 <web>
和 <webServer>
条目以确保它适用于IIS和Visual Studio开发服务器。例如:
<location path="Files">`
<system.webServer>
<handlers>
<add name="MyHandler" path="*" verb="*" type="MyHttpHandler" />
</handlers>
</system.webServer>
<system.web>
<httpHandlers>
<add path="*" verb="*" type="MyHttpHandler" />
</httpHandlers>
</system.web>
</location>