Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Upgrade Error Message #1102

Closed
etneodeck opened this issue Feb 7, 2024 · 4 comments
Closed

Version Upgrade Error Message #1102

etneodeck opened this issue Feb 7, 2024 · 4 comments

Comments

@etneodeck
Copy link

While upgrading Identity server from version 4 to 6.3.8, we are getting the following error message:

Autofac.Core.DependencyResolutionException: An exception was thrown while activating Duende.IdentityServer.Services.DefaultSessionCoordinationService -> λ:Duende.IdentityServer.Stores.IServerSideSessionStore.
 ---> Autofac.Core.DependencyResolutionException: A delegate registered to create instances of 'Duende.IdentityServer.Stores.IServerSideSessionStore' returned null.
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Delegate.DelegateActivator.<ConfigurePipeline>b__2_0(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext context)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.GetService(IServiceProvider sp, Type type, Type middleware)
   at lambda_method836(Closure , Object , HttpContext , IServiceProvider )
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass5_1.<UseMiddleware>b__2(HttpContext context)
   at Duende.IdentityServer.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes) in /_/src/IdentityServer/Hosting/MutualTlsEndpointMiddleware.cs:line 95
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Duende.IdentityServer.Hosting.DynamicProviders.DynamicSchemeAuthenticationMiddleware.Invoke(HttpContext context) in /_/src/IdentityServer/Hosting/DynamicProviders/DynamicSchemes/DynamicSchemeAuthenticationMiddleware.cs:line 50
   at Duende.IdentityServer.Hosting.BaseUrlMiddleware.Invoke(HttpContext context) in /_/src/IdentityServer/Hosting/BaseUrlMiddleware.cs:line 27
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

We confirm that the service keeps running but if I try to open identity in a browser, is where the error shows up.

We note that we use .net 6 but we don't use the ServerSide Session service.

Please, let us know what is causing this error message and how we can proceed with the upgrade.

Thank you.

@josephdecock
Copy link
Member

josephdecock commented Feb 8, 2024

IdentityServer internally uses a pattern of dependency injection in which services can be optional, and when an optional service is not present, a null value for that service is used. This pattern is supported by the default service provider implementation in ASP.NET - the Microsoft.Extensions.DependencyInjection.ServiceProvider. However some other service provider implementations, such as Autofac, don't allow this kind of injection. Our recommendation is to use the default service provider instead of Autofac. I'd be curious to know why you're using Autofac over the default service provider. In the past I've seen folks using Autofac because of its support for keyed services, but .NET 8 added IKeyedServiceProvider to add support for that feature in .NET 8 (supported by the newly released IdentityServer 7).

@josephdecock josephdecock self-assigned this Feb 8, 2024
@etneodeck
Copy link
Author

etneodeck commented Feb 14, 2024 via email

@josephdecock
Copy link
Member

IdentityServer has been using this pattern for several major releases over the past few years, so any change that we make now we would need to do carefully to avoid breaking changes. That said, we've created DuendeSoftware/IdentityServer#1520 that we're tentatively considering for our 7.1 release.

@etneodeck
Copy link
Author

etneodeck commented Feb 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants