亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

調用我的 webapi 時收到 400 錯誤請求

調用我的 webapi 時收到 400 錯誤請求

C#
慕標5832272 2022-11-13 15:00:38
創建了一個 webapi,在郵遞員中一切順利,但是當我在 Angular 7 中創建一個前端應用程序并嘗試登錄時出現錯誤:對預檢請求的響應未通過訪問控制檢查:沒有'Access-Control-Allow-Origin'請求的資源上存在標頭。試圖禁用 cors 以在 chrome 中進行開發,但仍然出現相同的錯誤,將 webapi 配置為允許所有,仍然相同,更改 web 配置以允許預檢方法的選項,仍然相同。(使用 owin) public void Configuration(IAppBuilder app)        {            var configuration = new HttpConfiguration();            ConfigureOAuth(app);            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);            WebApiConfig.Register(configuration);            app.UseWebApi(configuration);  <modules runAllManagedModulesForAllRequests="true">      <remove name="WebDAVModule" />    </modules>    <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>  </system.webServer>
查看完整描述

1 回答

?
翻過高山走不出你

TA貢獻1875條經驗 獲得超3個贊

查看完整回答
反對 回復 2022-11-13
  • 1 回答
  • 0 關注
  • 677 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號