小编tri*_*gri的帖子

'Access-Control-Allow-Origin'标头包含多个值'*,*',但只允许一个

我正在使用Angular和asp.net API.我面临的问题:当我在API代码中添加CORS时,它可以在Internet Explorer上运行,但在Chrome和Firefox上不起作用.

这是错误:

XMLHttpRequest无法加载http:// localhost:41028/api/values/abc.'Access-Control-Allow-Origin'标头包含多个值'*,*',但只允许一个.因此,不允许来源" http:// localhost:44796 "访问.

这是我在web.config文件中添加的代码:

<system.webServer>
...
<httpProtocol>
  <customHeaders>
      <!-- Adding the following custom HttpHeader will help prevent CORS errors -->
      <add name="Access-Control-Allow-Origin" value="*" />
      <add name="Access-Control-Allow-Headers" value="Content-Type" />
  </customHeaders>
</httpProtocol>
...
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

WebApiConfigFile.cs我添加的文件中:

var CorsAttribute = new EnableCorsAttribute("* ","* ", "* ");
        config.EnableCors(CorsAttribute);
Run Code Online (Sandbox Code Playgroud)

我是第一次使用CORS.任何帮助将不胜感激.

asp.net cors asp.net-web-api angularjs

28
推荐指数
2
解决办法
6万
查看次数

Flutter:Projetc 未在 iOS 模拟器上构建

Flutter 应用程序在 iOS 模拟器上构建失败,尽管它在 Android 模拟器上编译成功,但从命令行运行的 iOS 和 Android 物理设备 iOS 构建是成功的。

\n

Flutter版本从2.5.3升级到2.8.1后出现此问题。

\n

以前,它运行良好。

\n

构建输出

\n
This will generate a JSON format file containing all messages that \nneed to be translated.\nLaunching lib/src/app/main_staging.dart on iPhone 13 in debug mode...\nRunning Xcode build...\nXcode build done.                                            3.0s\nFailed to build iOS app\nError output from Xcode build:\n\xe2\x86\xb3\n    xcodebuild: error: Unable to find a destination matching the provided destination specifier:\n            { id:1DCE4D93-E8B4-40D1-BDC1-B8FA373B1961 }\n\n        Ineligible destinations for the "staging" scheme:\n            { platform:iOS, …
Run Code Online (Sandbox Code Playgroud)

xcode ios ios-simulator flutter

7
推荐指数
1
解决办法
9050
查看次数