IIS Express上具有属性路由的ASP.Net核心在发布时给出503错误

时间:2019-05-01 05:59:29

标签: asp.net-core model-view-controller attributerouting

我有一个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();
    }

enter image description here

0 个答案:

没有答案