同じ起動時にidentityserver3とweb api(Bearerトークンを使用するユーザー管理用)を共同ホストしようとしています。しかし、次のエラーが表示されます。 タスクがキャンセルされました。 http://identity_local/core/.well-known/openid-configuration(identity_localがlocalhostを指している)を呼び出そうとしたときに起動時にタスクのキャンセルが発生するようです。タスクがキャンセルされました
次のように私のスタートアップがあります。a)同じ起動中およびb)もしそうなら、両方持つことが可能である場合
app.Map("/core", idsrvApp =>
{
var factory = new IdentityServerServiceFactory();
factory.UserService = new IdentityServer3.Core.Configuration.Registration<IUserService, UserService>();
factory.ScopeStore = new IdentityServer3.Core.Configuration.Registration<IScopeStore>(resolver => scopeStore);
var options = new IdentityServerOptions
{
SigningCertificate = Certificate.Load(),
IssuerUri = "http://identity_local/core",
PublicOrigin = "http://identity_local",
RequireSsl = false, //for now
Factory = factory,
};
idsrvApp.UseIdentityServer(options);
});
app.Map("/admin", adminApp =>
{
adminApp.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "http://identity_local/core",
IssuerName = "identity_local",
ValidationMode = ValidationMode.Local,
RequiredScopes = new[] { "api", "roles" }
});
adminApp.UseResourceAuthorization(new AuthorisationManager());
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
adminApp.UseCors(CorsOptions.AllowAll);
adminApp.UseWebApi(config);
});
誰もが知っている、私が間違って何をしたか、私が何を行うことができます上記を是正する。
あなたは私のヒーローです!私は1週間ソリューションを探していました。また、 'IdentityServerBearerTokenAuthenticationOptions'に' DelayLoadMetadata = true'を設定するだけで、そのトリックが実行されました。これは正解とマークする必要があります。実際には、IdentityServer3の初歩的なウォークスルーにあるはずです。 – Michael