web.config中加入
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value=" 在这里设置允许跨域的域名,多个用‘,’隔开 " />
<add name="Access-Control-Allow-Headers" value="X-AspNet-Version,X-Powered-By,Date,Server,Accept,Accept-Encoding,Accept-Language,Cache-Control,Connection,Content-Length,Content-Type,Host,Origin,Pragma,Referer,User-Agent" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, OPTIONS" />
<add name="Access-Control-Max-Age" value="1000" />
</customHeaders>
</httpProtocol>
<!--注意层级-->
</system.webServer>
</configuration>