首先在配置文件中添加下面的代码,log4net.config的那句不用管。
<add key="Access-Control-Allow-Origin" value="http://localhost:4321,http://localhost:2020,http://localhost:8701" />这句是允许跨域请求的网站,可以添加多个。
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<!-- To define the config file for the logginf function -->
<add key="log4net.Config" value="param\log.config" />
<!--If debug is true, the following account and password can be valid,
and the following ad account and ad password are in development mode.
Publishing Webapi needs to be set to false-->
<!--Access-Control-Allow-Origin-->
<add key="Access-Control-Allow-Origin" value="http://localhost:4321,http://localhost:2020,http://localhost:8701" />
<!--Access-Control-Allow-Headers-->
<add key="Access-Control-Allow-Header