IdentityServer4为每个端点返回404状态代码

时间:2019-08-03 03:05:25

标签: identityserver4

我一直在评估IdentityServer,因为我们希望在工作中使用它。尽管可以轻松在Dev环境中使用Visual Studio来运行,但我从未能够将其作为部署在家庭服务器(Windows 2019 Server)上运行。

我在该服务器上运行了其他简单的ASP.NET站点,因此我证明IIS可以正常工作并且可以为站点提供服务。

当我尝试加载MVC UI快速入门(已部署)时,我仅收到404响应。我可以在任何端点上使用它.well-known/openid-configuration

由于IIS日志没有显示出任何启发性的信息,我一直在找出问题出在很多麻烦上。

我正在为网站使用SSL的自签名证书。
我使用OpenSSL为签名凭证创建了pfx。这在开发环境中工作正常。我正在从特定目录(IIS_IUSRS拥有权限)加载它。

这是我的配置方法:

public void ConfigureServices(IServiceCollection services)
{

    services.AddIdentityServer()
        //.AddDeveloperSigningCredential()
        .AddSigningCredential(new X509Certificate2(Path.Combine(@"E:\Certs\id4.pfx"), "opensesame"))
        .AddTestUsers(InMemoryConfiguration.Users().ToList())
        .AddInMemoryClients(InMemoryConfiguration.Clients())
        .AddInMemoryApiResources(InMemoryConfiguration.ApiResources());   

  services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}

和:

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
    }
    else
    {
        app.UseExceptionHandler("/Home/Error");
        // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    }

    app.UseIdentityServer();

    app.UseStaticFiles();

    app.UseMvcWithDefaultRoute();
}

其他信息
Windows Hosting捆绑包已安装(我正在运行其他Core 2.2应用程序)。
应用程序池以No Managed Code作为.NET CLR版本运行。 Enable 32-bit Applications设置为False。
网站本身具有默认设置。 AnonymousBasic Authentication已启用。
它同时具有用于端口80的http绑定和用于端口443的https绑定。

由发布生成的Web.config是:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\SimpleIdp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
    </system.webServer>
  </location>
</configuration>
<!--ProjectGuid: 6418350e-fa8e-4ac9-9201-f4ba2a4a6abf-->

在过去的几个月里,我经历了几次这样的磨合,并且总是在同一个地方结束。因此,如果有人能够提供帮助,那就太好了。

谢谢

0 个答案:

没有答案
相关问题