2017-11-27 4 views
0

Ich verwende ASP.Net 4.5 und verwende .Net Framework 4.5.1 Die Anwendung funktionierte lokal einwandfrei. nach meiner letzten Installation von .net Core 2.0, erhalte ich die folgende Fehlermeldung. Nicht sicher, was falsch gelaufen ist.VisualStudio 2015 Dokument konnte nicht abgerufen werden https: // localhost: 44300/identity/.well-known/openid-configuration "

hat jemand begegnet dieser ähnlich?

Unable to get document https://localhost:44300/identity/.well-known/openid-configuration" 

{"IDX10803: Unable to create to obtain configuration from: 'https://localhost:44300/identity/.well-known/openid-configuration'."} 

ich diese Ausnahme in Start bin immer. cs, und der Code lautet:

app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions 
    { 
     Authority = Constants.IdSrv, 
     RequiredScopes = new[] {"web_api"} 
    }); 

Danke

Antwort

0

Wenn Sie zu .net core migrieren, müssen Sie Meadleware für Identity Server 4 verwenden. Sie verwenden jedoch basic auth.

var cert = new X509Certificate2(Path.Combine(_currentEnvironment.ContentRootPath, "Cert\\Cert.pfx"), "123456"); 
      services.AddIdentityServer() 
       .AddInMemoryApiResources(Config.GetApisResources()) 
       .AddSigningCredential(cert) 
       .AddInMemoryClients(Config.GetClients()) 
       .AddInMemoryPersistedGrants() 
       .AddInMemoryIdentityResources(Config.GetIdentityResources()) 
       .Services.AddTransient<IResourceOwnerPasswordValidator, ResourceOwnerPasswordValidator>(); 


public class Config 
    { 
     public static IEnumerable<IdentityResource> GetIdentityResources() 
     { 
      return new List<IdentityResource> 
      { 
       new IdentityResources.OpenId(), 
       new IdentityResources.Profile(), 
      }; 
     } 
     public static IEnumerable<ApiResource> GetApisResources() 
     { 
      return new[] 
      { 
       // simple API with a single scope (in this case the scope name is the same as the api name) 
       new ApiResource("API", "api system"), 

      }; 
     } 


     public static IEnumerable<Client> GetClients() 
     { 
      return new List<Client> 
      { 
       new Client 
       { 
        ClientId = "UI", 
        AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials, 
        AccessTokenLifetime = 300, 

        AllowOfflineAccess=true, 
        RefreshTokenExpiration = TokenExpiration.Absolute, 
        AbsoluteRefreshTokenLifetime = 999999, 
        RefreshTokenUsage=TokenUsage.ReUse, 
        AccessTokenType=AccessTokenType.Jwt, 

        ClientSecrets = 
        { 
         new Secret("secretKey".Sha256()) 
        }, 

        AllowedScopes = 
        { 
         "API", 
         IdentityServerConstants.StandardScopes.OfflineAccess 
        } 
       } 
      }; 
     } 
    } 
+0

@Nein ich migriert dieses Projekt nicht. das läuft noch in .net 4.5 –

Verwandte Themen