简体   繁体   中英

IdentityServer on Azure

I'm trying to make an ASP.NET Core Web application to host IdentityServer and use it as my main authorization service, shared across many other apps.

I followed the quick start tutorial that consists in installing a nuget package (called IdentityServer4) in an empty MVC application template.

Everything is working fine on my machine (debugging with VS2017 & VS2019 preview). I tried to publish the app as an Azure App Service like i did with previous apps and worked fine.

While debugging, if i open a browser and type " https://localhost:44316/ ", i see this page:

在此处输入图片说明

But navigating to " https://xxx.azurewebsites.net " (that is where i published the app) is not working. Responding 404 not found.

Just to add some detail, if i navigate this " https://localhost:44316/Account/Login?ReturnUrl=%2Fgrants ", i obtain the correct login page and doing the same on Azure produces the same result.

So, essentially, looks like it's working, except for the home page.

I'm not an expert in routing with ASP.NET Core, so don't blame me if my question is not so smart.

So, essentially, looks like it's working, except for the home page.

This is actually the intended behaviour - If you take a look at the implementation of the HomeController provided in theIdentityServer4.Quickstart.UI project, you'll see the following implementation ( source ):

public IActionResult Index()
{
    if (_environment.IsDevelopment())
    {
        // only show in development
        return View();
    }

    _logger.LogInformation("Homepage is disabled in production. Returning 404.");
    return NotFound();
}

When running in Azure, the application's environment isn't set to Development environment and so returns 404 NotFound, as shown above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM