且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 IIS 7.5 中托管的 Web Api 中找不到 HTTP 404 页面

更新时间:2022-11-06 16:16:45

我也为此苦恼.幸运的是,Steve Michelotti 记录了一个对我有用的解决方案 这里.

I was struggling with this as well. Fortunately, Steve Michelotti documented a solution that worked for me here.

在一天结束时,我在我的网络配置中为 ExtensionlessUrlHandler-Integrated-4.0 处理程序启用了所有动词(动词 =*").

At the end of the day, I enabled all verbs (verb="*") to the ExtensionlessUrlHandler-Integrated-4.0 handler in my web config.

<system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
        <handlers>
            <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
            <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
        </handlers>
</system.webServer>

其他人指出启用 WebDAV 会导致问题.幸运的是,我也没有遇到这个问题.

Others have pointed out that having WebDAV enabled causes issues. Fortunately, I did not run into that issue as well.