2021-09-09 港控/mmm° 2022-09-10 15:12 142阅读 0赞 ### .NET WebService 后端解决跨域问题 ### 可直接在**web.config**文件中加入对应配置实现: <system.web> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> <add name="HttpSoap"/> <add name="Documentation"/> </protocols> </webServices> </system.web> <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Methods" value="OPTIONS,POST,GET"/> <add name="Access-Control-Allow-Headers" value="x-requested-with,content-type"/> <add name="Access-Control-Allow-Origin" value="*"/> </customHeaders> </httpProtocol> </system.webServer> 至此,已完美解决~
还没有评论,来说两句吧...