Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

autofac system.object returns null. Trying to combine AspIdentity and MVC View service together #3869

Open
siddhant4u opened this issue Sep 22, 2017 · 2 comments
Labels

Comments

@siddhant4u
Copy link

I'm trying to combine Asp.net Identity along with MVC View Service. So far I'm able to work on individual configuration based on Samples from github i.e. my identityserver3 works using my existing asp.net identity database Or I can configure view service using MVC ViewService example but when I try to combine both It doesn't work. I get -

Unhandled exception accessing: /core/connect/authorize
Autofac.Core.DependencyResolutionException: A delegate registered to create instances of 'System.Object' returned null.

at line
idSvrFactory.Register(new Registration<HttpContextBase>(resolver => new HttpContextWrapper(resolver.Resolve<HttpContext>())));

my identityserver3 settings are -

 appBuilder.Map("/core", core =>
            {
                var idSvrFactory = Factory.Configure();

                // These registrations are also needed since these are dealt with using non-standard construction
                idSvrFactory.Register(new Registration<HttpContext>(resolver => HttpContext.Current));
                idSvrFactory.Register(new Registration<HttpContextBase>(resolver => new HttpContextWrapper(resolver.Resolve<HttpContext>())));
                idSvrFactory.Register(new Registration<HttpRequestBase>(resolver => resolver.Resolve<HttpContextBase>().Request));
                idSvrFactory.Register(new Registration<HttpResponseBase>(resolver => resolver.Resolve<HttpContextBase>().Response));
                idSvrFactory.Register(new Registration<HttpServerUtilityBase>(resolver => resolver.Resolve<HttpContextBase>().Server));
                idSvrFactory.Register(new Registration<HttpSessionStateBase>(resolver => resolver.Resolve<HttpContextBase>().Session));

                idSvrFactory.ConfigureEPMUserService("AspId_CustomPK");
                idSvrFactory.ViewService = new Registration<IViewService, MvcViewService<LogonWorkflowController>>();

                var options = new IdentityServerOptions
                {
                    SiteName = "IdentityServer3 - UserService-AspNetIdentity",
                    SigningCertificate = Certificate.Get(),
                    Factory = idSvrFactory,
                    AuthenticationOptions = new AuthenticationOptions
                    {
                        IdentityProviders = ConfigureAdditionalIdentityProviders
                    }
                };

                core.UseIdentityServer(options);
            });

ConfigureEPMSerivce code is -

factory.UserService = new Registration<IUserService, EPMUserService>();
          factory.Register(new Registration<ApplicationUserStore>());
          factory.Register(new Registration<ApplicationRoleStore>());
          factory.Register(new Registration<ApplicationUserManager>());
          factory.Register(new Registration<ApplicationRoleManager>());
          factory.Register(new Registration<ApplicationDbContext>(resolver => new ApplicationDbContext(connString)));

I tried google'ing so far no help from stackoverflow either

https://stackoverflow.com/questions/46339639/identityserver3-mvc-service-view-with-aspidentity-a-delegate-registered-to

I'm not using autofac in my project.

Relevant parts of the log file

iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 Start discovery request
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 Start key discovery request
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 Start authorize request
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 Start authorize request protocol validation
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 "Authorize request validation success"
 "{
  \"ClientId\": \"ReportingDashboard\",
  \"ClientName\": \"ISEM Reporting Dashboard\",
  \"RedirectUri\": \"https://localhost:44395/\",
  \"AllowedRedirectUris\": [
    \"https://localhost:44395/\"
  ],
  \"SubjectId\": \"unknown\",
  \"ResponseType\": \"code id_token\",
  \"ResponseMode\": \"form_post\",
  \"Flow\": \"Hybrid\",
  \"RequestedScopes\": \"openid profile email roles reportAPI\",
  \"State\": \"OpenIdConnect.AuthenticationProperties=etWpAZxKdoudy0IuOYKpt8fzSekr5SzqMflB5egTemOY1QA60A_xGVnflp2thwdBBeLRKlUCIbDBNWP7cX6j3AzlrDX-TuTMXAXDkJXHQfOWS9g7w7xaPLUx1GfgkBcnNz2rX1Bj7aEY1GiFeTfosv42D3q_s-uB5ocbz3n32NicqxVoXOeSlJacJSnKBUPmJ9jnUV3KQkjBeSwV1B8FYA\",
  \"Nonce\": \"636416696781595341.MTBlZWY5YmUtYmRjZC00ZGUxLWI3ZTctNjRkZjI0MmU2YTA5OTEyODZkYjItZDM2My00NWVhLThhMTEtM2E4Y2M5MjY2NTk3\",
  \"Raw\": {
    \"client_id\": \"ReportingDashboard\",
    \"redirect_uri\": \"https://localhost:44395/\",
    \"response_mode\": \"form_post\",
    \"response_type\": \"code id_token\",
    \"scope\": \"openid profile email roles reportAPI\",
    \"state\": \"OpenIdConnect.AuthenticationProperties=etWpAZxKdoudy0IuOYKpt8fzSekr5SzqMflB5egTemOY1QA60A_xGVnflp2thwdBBeLRKlUCIbDBNWP7cX6j3AzlrDX-TuTMXAXDkJXHQfOWS9g7w7xaPLUx1GfgkBcnNz2rX1Bj7aEY1GiFeTfosv42D3q_s-uB5ocbz3n32NicqxVoXOeSlJacJSnKBUPmJ9jnUV3KQkjBeSwV1B8FYA\",
    \"nonce\": \"636416696781595341.MTBlZWY5YmUtYmRjZC00ZGUxLWI3ZTctNjRkZjI0MmU2YTA5OTEyODZkYjItZDM2My00NWVhLThhMTEtM2E4Y2M5MjY2NTk3\",
    \"x-client-SKU\": \"ID_NET\",
    \"x-client-ver\": \"1.0.40306.1554\"
  }
}"
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 User is not authenticated. Redirecting to login.
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 End authorize request
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 Redirecting to login page
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 Login page requested
iisexpress.exe Information: 0 : 09/22/2017 10:34:38 +01:00 [Information] ()
 rendering login page
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Login page submitted
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Login credentials successfully validated by user service
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Calling PostAuthenticateAsync on the user service
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 issuing primary signin cookie
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 redirecting to: https://localhost:44333/core/connect/authorize?client_id=ReportingDashboard&redirect_uri=https://localhost:44395/&response_mode=form_post&response_type=code id_token&scope=openid profile email roles reportAPI&state=OpenIdConnect.AuthenticationProperties=etWpAZxKdoudy0IuOYKpt8fzSekr5SzqMflB5egTemOY1QA60A_xGVnflp2thwdBBeLRKlUCIbDBNWP7cX6j3AzlrDX-TuTMXAXDkJXHQfOWS9g7w7xaPLUx1GfgkBcnNz2rX1Bj7aEY1GiFeTfosv42D3q_s-uB5ocbz3n32NicqxVoXOeSlJacJSnKBUPmJ9jnUV3KQkjBeSwV1B8FYA&nonce=636416696781595341.MTBlZWY5YmUtYmRjZC00ZGUxLWI3ZTctNjRkZjI0MmU2YTA5OTEyODZkYjItZDM2My00NWVhLThhMTEtM2E4Y2M5MjY2NTk3&x-client-SKU=ID_NET&x-client-ver=1.0.40306.1554
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Start authorize request
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Start authorize request protocol validation
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 "Authorize request validation success"
 "{
  \"ClientId\": \"ReportingDashboard\",
  \"ClientName\": \"ISEM Reporting Dashboard\",
  \"RedirectUri\": \"https://localhost:44395/\",
  \"AllowedRedirectUris\": [
    \"https://localhost:44395/\"
  ],
  \"SubjectId\": \"898c3797-56eb-4a56-b873-186e400f339b\",
  \"ResponseType\": \"code id_token\",
  \"ResponseMode\": \"form_post\",
  \"Flow\": \"Hybrid\",
  \"RequestedScopes\": \"openid profile email roles reportAPI\",
  \"State\": \"OpenIdConnect.AuthenticationProperties=etWpAZxKdoudy0IuOYKpt8fzSekr5SzqMflB5egTemOY1QA60A_xGVnflp2thwdBBeLRKlUCIbDBNWP7cX6j3AzlrDX-TuTMXAXDkJXHQfOWS9g7w7xaPLUx1GfgkBcnNz2rX1Bj7aEY1GiFeTfosv42D3q_s-uB5ocbz3n32NicqxVoXOeSlJacJSnKBUPmJ9jnUV3KQkjBeSwV1B8FYA\",
  \"Nonce\": \"636416696781595341.MTBlZWY5YmUtYmRjZC00ZGUxLWI3ZTctNjRkZjI0MmU2YTA5OTEyODZkYjItZDM2My00NWVhLThhMTEtM2E4Y2M5MjY2NTk3\",
  \"SessionId\": \"8f26579a603e8fde17d6c2083a780921\",
  \"Raw\": {
    \"client_id\": \"ReportingDashboard\",
    \"redirect_uri\": \"https://localhost:44395/\",
    \"response_mode\": \"form_post\",
    \"response_type\": \"code id_token\",
    \"scope\": \"openid profile email roles reportAPI\",
    \"state\": \"OpenIdConnect.AuthenticationProperties=etWpAZxKdoudy0IuOYKpt8fzSekr5SzqMflB5egTemOY1QA60A_xGVnflp2thwdBBeLRKlUCIbDBNWP7cX6j3AzlrDX-TuTMXAXDkJXHQfOWS9g7w7xaPLUx1GfgkBcnNz2rX1Bj7aEY1GiFeTfosv42D3q_s-uB5ocbz3n32NicqxVoXOeSlJacJSnKBUPmJ9jnUV3KQkjBeSwV1B8FYA\",
    \"nonce\": \"636416696781595341.MTBlZWY5YmUtYmRjZC00ZGUxLWI3ZTctNjRkZjI0MmU2YTA5OTEyODZkYjItZDM2My00NWVhLThhMTEtM2E4Y2M5MjY2NTk3\",
    \"x-client-SKU\": \"ID_NET\",
    \"x-client-ver\": \"1.0.40306.1554\"
  }
}"
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Creating Hybrid Flow response.
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Creating Implicit Flow response.
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Getting claims for identity token for subject: 898c3797-56eb-4a56-b873-186e400f339b
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 End authorize request
iisexpress.exe Information: 0 : 09/22/2017 10:34:49 +01:00 [Information] ()
 Posting to https://localhost:44395/
iisexpress.exe Error: 0 : 09/22/2017 10:34:53 +01:00 [Error] ()
 Unhandled exception accessing: /core/connect/authorize
Autofac.Core.DependencyResolutionException: A delegate registered to create instances of 'System.Object' returned null.
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Registration.ExternalRegistrySource.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at IdentityServer3.Core.Services.Default.AutofacDependencyResolver.Resolve[T](String name) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Services\Default\AutofacDependencyResolver.cs:line 36
   at MvcViewServiceSample.Startup.<>c.<Configuration>b__0_2(IDependencyResolver resolver) in D:\users\gbrapur\documents\visual studio 2015\Projects\IdentityServer3.Samples-old\source\MVC ViewService\MvcViewServiceSample\Startup.cs:line 59
   at IdentityServer3.Core.Configuration.Hosting.AutofacConfig.<>c__DisplayClass1a.<Register>b__17(IComponentContext ctx) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\AutoFacConfig.cs:line 317
   at Autofac.RegistrationExtensions.<>c__DisplayClass10`1.<Register>b__f(IComponentContext c, IEnumerable`1 p) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Registration.ExternalRegistrySource.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Activators.Reflection.AutowiringParameter.<>c__DisplayClass2.<CanSupplyValue>b__0() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Registration.ExternalRegistrySource.<>c__DisplayClass8.<RegistrationsFor>b__3(IComponentContext c, IEnumerable`1 p) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.InstanceLookup.Execute() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Internal\AntiXssLibrary\UnicodeCharacterEncoder.cs:line 0
   at IdentityServer3.Core.Extensions.InternalOwinExtensions.ResolveDependency(IOwinContext context, Type type) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Extensions\InternalOwinExtensions.cs:line 78
   at IdentityServer3.Core.Extensions.InternalOwinExtensions.ResolveDependency[T](IOwinContext context) in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Extensions\InternalOwinExtensions.cs:line 70
   at IdentityServer3.Core.Results.AuthorizeFormPostResult.<ExecuteAsync>d__6.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Results\AuthorizeFormPostResult.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext() in c:\ballen\github\identity\IdSrv3\IdentityServer3\source\Core\Configuration\Hosting\NoCacheAttribute.cs:line 0
iisexpress.exe Error: 0 : 09/22/2017 10:34:55 +01:00 [Error] ()
 Unhandled exception accessing: /core/connect/authorize
@siddhant4u
Copy link
Author

HttpContext.Current is always null in below line. Not sure if that's causing the issue in next one for HttpContextBase registration

idSvrFactory.Register(new Registration<HttpContext>(resolver => HttpContext.Current));

@brockallen
Copy link
Member

Don't know. Sorry.

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

No branches or pull requests

2 participants