1
我有一個MVC 4應用程序使用角度向Web API應用程序發送http POSTS請求。一切正常的發展環境符合市場預期,但在部署到我們的生產環境我得到下面的錯誤在瀏覽器中XMLHttpRequest:網絡錯誤訪問被拒絕
XMLHttpRequest: Network Error 0x80070005, Access is denied.
這看起來像一個CORS問題的控制檯日誌,我添加以下代碼我的web.config
<system.webServer>
<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>
<httpProtocol>
<customHeaders>
<clear />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD, OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
</customHeaders>
</httpProtocol>
跟着Enabling Cross-Origin Requests in ASP.NET Web API 2無濟於事。還有什麼我失蹤?