Project settings are accessible across domains

 

 1 There are interfaces in the project. When other projects come to access, they will encounter cross-domain inaccessibility. Add some code to the project's config file.

<system.webServer>
    <httpProtocol>
      <!--跨域配置开始-->
      <customHeaders>
        <add name="Access-Control-Allow-Origin" value="*" />
        <!--支持全域名访问,不安全,部署后需要固定限制为客户端网址-->
        <add name="Access-Control-Allow-Methods" value="GET, POST, PUT, DELETE, OPTIONS" />
        <!--支持的http 动作-->
        <add name="Access-Control-Allow-Headers" value="Content-Type,X-Requested-With,token" />
        <!--响应头 请按照自己需求添加 这里新加了token这个headers-->
      
      </customHeaders>
      <!--跨域配置结束-->
   </httpProtocol>
</system.webServer>

Guess you like

Origin blog.csdn.net/zhang123csdn/article/details/125659007