请求跨域处理

在web.config 配置文件增加以下节点配置信息:

<!--支持跨域-->
  <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>


猜你喜欢

转载自blog.csdn.net/LZD_jay/article/details/78455537