0
huntethan89 created
I tried following code to enable CORS but when I'm calling api from another domain, it is still giving error-
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
// Enabling CORS:
var cors = new EnableCorsAttribute(origins: "*", headers: "*", methods: "*");
Configuration.Modules.AbpWebApi().HttpConfiguration.EnableCors(cors);
//Automatically creates Web API controllers for all application services of the application
Configuration.Modules.AbpWebApi().DynamicApiControllerBuilder
.ForAll<IApplicationService>(typeof(ProjectLearnApplicationModule).Assembly, "app")
.Build();
Configuration.Modules.AbpWebApi().HttpConfiguration.Filters.Add(new HostAuthenticationFilter("Bearer"));
ConfigureSwaggerUi(); //Remove this line to disable swagger UI.
}
Do I need to make modifications at any other place? I'm using ASPNET MVC + jQuery
5 Answer(s)
-
0
try
System.Web.Http.GlobalConfiguration.Configuration.EnableCors(cors);
-
0
Same issue
-
0
Can you use the Demo project to reproduce it? If you can, you can send the project to: [email protected]
-
0
Is it possible that an invalid SSL certificate for Web API project could cause this issue?
-
0
You can try it with non-https