1.在.WebApi项目中使用 NuGet Install-Package Microsoft.AspNet.WebApi.Cors
2.在xxxWebApiModule类中添加如下代码
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly()); DynamicApiControllerBuilder
.ForAll<IApplicationService>(typeof(demoApplicationModule).Assembly, "app")
.Build(); Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer"));
var cors = new EnableCorsAttribute("*", "*", "*");
GlobalConfiguration.Configuration.EnableCors(cors);
}