2017-11-27 14 views
0

ASP.Net 4.5を使用し、.NET Framework 4.5.1を使用しています。 .NETコア2.0の私の最近のインストールの後、私は次のエラーを取得しています。間違っているのかわからない。Visualstudio 2015ドキュメントを取得できません。https:// localhost:44300/identity/.well-known/openid-configuration "

誰もが、私は、起動中にこの例外を取得しています。この類似した?

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'."} 

渡って来るん。コードは:

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

ありがとう

答えて

0

.netコアに移行する場合、IDサーバ4にはMeadlewareを使用する必要がありますが、基本認証を使用します。

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

@いいえ、私はこのプロジェクトを移行しませんでした。これはまだネット4.5で動作しています –

関連する問題