Add Cors handling to Blazor UI
This commit is contained in:
24
MarketDataServer/MarketDataServer.sln
Normal file
24
MarketDataServer/MarketDataServer.sln
Normal file
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MarketDataServer", "MarketDataServer.csproj", "{95632102-7AD8-9B9D-1583-0C986A476083}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{95632102-7AD8-9B9D-1583-0C986A476083}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{95632102-7AD8-9B9D-1583-0C986A476083}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{95632102-7AD8-9B9D-1583-0C986A476083}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{95632102-7AD8-9B9D-1583-0C986A476083}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {216F126F-209B-4547-90B2-17250197CD7D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -40,7 +40,17 @@ namespace MarketDataServer
|
||||
config.ResolveConflictingActions (apiDescriptions => apiDescriptions.First ());
|
||||
});
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("corsPolicy",
|
||||
builder =>
|
||||
{
|
||||
builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||
});
|
||||
});
|
||||
|
||||
WebApplication webApplication = builder.Build();
|
||||
webApplication.UseCors("corsPolicy");
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (webApplication.Environment.IsDevelopment()||webApplication.Environment.IsProduction() )
|
||||
|
||||
Reference in New Issue
Block a user