我有一个ASP.NET Core MVC控制器,其属性路由在本地运行良好,例如https://localhost:44322/adfs/account/login,但是在IIS上发布时返回503(服务不可用)错误,其他没有属性路由的路由也可以正常工作在事件查看器中没有错误登录。
[SecurityHeaders]
[Route("adfs/account")]
public class AccountController : Controller
{
[HttpGet]
[Route("Login")]
public async Task<IActionResult> Login(string returnUrl)
{//some code}
}
在Startup.cs
public void Configure(IApplicationBuilder app, IHostingEnvironment
env, ILoggerFactory loggerFactory)
{
app.UseDeveloperExceptionPage();
app.UseStaticFiles();
app.Use(async (ctx, next) =>
{
ctx.Response.Headers.Add("Content-Security-Policy",
"default-src 'self' * 'unsafe-inline' 'unsafe-eval' data:");
await next();
});
app.UseIdentityServer();
app.UseMvcWithDefaultRoute();
}