In the ConfigureServices method of your startup.cs, add the CORS services.
public void ConfigureServices(IServiceCollection services)
{
services.AddCors();
}
Then in your Configure method of your startup.cs, add the following :
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseCors(
options => options.WithOrigins("*").AllowAnyMethod()
);
Today the sandbox.js is still not able to communicate with the sandbox, because of CORS restrictions. I have made a (rudimental) patch for the Hub, hope it is useful.
To allows JavaScript on the browser to send subscription request and notification to the hub with Ajax, I believe we have to change the startup.cs file. This post describes the change: https://stackoverflow.com/questions/44379560/how-to-enable-cors-in-asp-net-core-webapi
In the ConfigureServices method of your startup.cs, add the CORS services. public void ConfigureServices(IServiceCollection services) { services.AddCors(); } Then in your Configure method of your startup.cs, add the following : public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { app.UseCors( options => options.WithOrigins("*").AllowAnyMethod() );
}