在azure上部署asp.net core angular应用程序后,它不会显示客户端,而是显示swagger "配置(IApplicationBuilder应用程序,IWebHostEnvironment环境){如果(env.IsDevelopment ()){app.UseDeveloperExceptionPage ();}其他的{app.UseExceptionHandler("/Error";app.UseHsts ();}
app.UseCors(options =>
options.WithOrigins("http://localhost:4200")
.AllowAnyMethod()
.AllowAnyHeader());
app.UseStaticFiles();
app.UseDefaultFiles();
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "CameraApp v1");
c.RoutePrefix = string.Empty;
});
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
你可以直接把索引url重定向到你的angular应用所在的url:
app.UseEndpoints(endpoints => {
...
endpoints.MapGet("/", (context) => {
context.Response.Redirect("/Account/Login");
});
});