Hi
We are having problems connecting SignalR to the public MVC page and are getting the following error
We have successfully been using SignalR for our Blazor WASM backend (hosted as static website in Azure) so we know all about how SignalR should work (or we thought at least).
We have been trying all kinds versions of CORS settings in HttpApi.Host without luck
This didn´t do anything (now we are just using app.UseCors())
app.UseCors(x => x
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(origin => true)
.AllowCredentials());
Is there a documentation or some other steps that we might be missing for for connecting with signalR in MVC public web app?
- ABP Framework version: 7.0.2
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated: yes
8 Answer(s)
-
0
You are using wildcard ('*') with
.AllowCredentials. You need to whitelist the origins.You can configure CORS in publicwebdev app as:
context.Services.AddCors(options => { options.AddDefaultPolicy(builder => { builder .WithOrigins("https://eventstreamingapidev.azurewebsites.net") .WithAbpExposedHeaders() .SetIsOriginAllowedToAllowWildcardSubdomains() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); });Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Did you also add https://eventstreamingpublicwebdev.azurewebsites.net to https://eventstreamingapidev.azurewebsites.net CORS origins?
Can you try removing
.AllowCredentials();and test again?Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
Did you try removing
.AllowCredentials();and tested again?Do you still get the same error? Did you check the appsettings.json file is overridden correctly on deployment?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
-
0
Yes, if you can check the module ConfigureServices method that has CORS configuration, you are basically missing it.
You may also forget to override it on production environment aswell.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)



