gpt4 book ai didi

c# - CORS 请求的资源上不存在 'Access-Control-Allow-Origin' header

转载 作者:行者123 更新时间:2023-11-28 19:49:40 25 4
gpt4 key购买 nike

我收到以下错误:

XMLHttpRequest cannot load http://localhost:62574/ServiceClass.asmx?op=loadMarkersViaWebService. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:15540' is therefore not allowed access. 

所以我在 Web.Config 中添加了以下内容,但错误仍然存​​在:

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="http://localhost:15540/"/>
</customHeaders>
</httpProtocol>

最佳答案

尝试使用这个..

<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Accept" />
</customHeaders>
</httpProtocol>

关于c# - CORS 请求的资源上不存在 'Access-Control-Allow-Origin' header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23722394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com