refactor: 根据 NETCore 3.0 文档移动 Cors 到 Routing 后面

This commit is contained in:
Argo Zhang 2019-10-26 15:29:44 +08:00
parent 6636c31023
commit c42bc15890
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
2 changed files with 5 additions and 4 deletions

View File

@ -102,18 +102,20 @@ namespace Bootstrap.Admin
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseStatusCodePagesWithReExecute("/Home/Error/{0}");
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseHttpsRedirection();
app.UseResponseCompression();
app.UseStaticFiles();
app.UseAutoGenerateDatabase();
app.UseRouting();
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseBootstrapAdminAuthentication("", RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseAuthorization();
app.UseSwagger(Configuration["SwaggerPathBase"].TrimEnd('/'));
app.UseOnlineUsers(TraceHelper.Filter, TraceHelper.Save);
app.UseCacheManager();
app.UseOnlineUsers(TraceHelper.Filter, TraceHelper.Save);
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<SignalRHub>("/NotiHub");

View File

@ -84,13 +84,12 @@ namespace Bootstrap.Client
}
app.UseStatusCodePagesWithReExecute("/Home/Error/{0}");
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseHttpsRedirection();
app.UseResponseCompression();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseRouting();
app.UseCors(builder => builder.WithOrigins(Configuration["AllowOrigins"].Split(',', StringSplitOptions.RemoveEmptyEntries)).AllowAnyHeader().AllowAnyMethod().AllowCredentials());
app.UseBootstrapAdminAuthentication("2", RoleHelper.RetrievesByUserName, RoleHelper.RetrievesByUrl, AppHelper.RetrievesByUserName);
app.UseAuthorization();
app.UseCacheManager();