Closed DataJuggler closed 3 years ago
Can you share your packages.config? Something is referencing the System.Net.Http package when it shouldn't, that library is available in the framework.
Oh, looks like you've fixed it? I'll close this then.
Yeah, I have other issues, but my issue I created there was fixed by updating binding redirects.
Thanks, sorry I didn’t mark it as closed.
From: Chris Ross @.> Sent: Friday, July 30, 2021 2:23 PM To: aspnet/AspNetKatana @.> Cc: Corby Nichols @.>; Author @.> Subject: Re: [aspnet/AspNetKatana] OpenIdConnectAuthenticationOptions causes System.Net.Http to not be found (#425)
Oh, looks like you've fixed it? I'll close this then.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetKatana/issues/425#issuecomment-890104936, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGI4P7O24R3NPO27LAKZF73T2L325ANCNFSM5BI7GJYQ.
I fixed it thanks to this, the rebuilding binding redirects did it. https://stackoverflow.com/questions/38408167/could-not-load-file-or-assembly-system-net-http-version-4-0-0-0-culture-neutr
I have been on this for a week. I upgraded our .Net Framework 4.6.1 app to 4.8, reinstalled all the nuget packages, and everything compiles and runs, unless I add the OpenIdConnectAuthenticationOptions then I get an error.
Here is part of the code in Startup.cs.
// Configure the db context, user manager and role manager to use a single instance per request app.CreatePerOwinContext(WebDbContext.Create);
app.CreatePerOwinContext(ApplicationUserManager.Create);
app.CreatePerOwinContext(ApplicationSignInManager.Create);
OpenIdConnectAuthenticationOptions options = new OpenIdConnectAuthenticationOptions(); options.ClientId = clientId; options.Authority = authority; options.RedirectUri = redirectUri; options.PostLogoutRedirectUri = redirectUri; options.Scope = OpenIdConnectScope.OpenIdProfile; options.ResponseType = OpenIdConnectResponseType.CodeIdToken; options.TokenValidationParameters = new TokenValidationParameters() { ValidateIssuer = false }; options.ProtocolValidator = new OpenIdConnectProtocolValidator() { RequireNonce = false }; // OpenIdConnectAuthenticationNotifications configures OWIN to send notification of failed authentications to OnAuthenticationFailed method options.Notifications = new OpenIdConnectAuthenticationNotifications { AuthenticationFailed = OnAuthenticationFailed };
I have tried upgrading to 4.3.4, tried the 4.0.0 version it looks for, tried redirecting all versions, and still get this error:
Is this a known issue, because I have searched and not found anything about conflicts with this.
[FileLoadException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] Microsoft.Owin.Security.OpenIdConnect.OpenIdConnectAuthenticationMiddleware..ctor(OwinMiddleware next, IAppBuilder app, OpenIdConnectAuthenticationOptions options) +0 lambda_method(Closure , OwinMiddleware , IAppBuilder , OpenIdConnectAuthenticationOptions ) +55
[TargetInvocationException: Exception has been thrown by the target of an invocation.] System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0 System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +168 System.Delegate.DynamicInvokeImpl(Object[] args) +124 Microsoft.Owin.Builder.AppBuilder.BuildInternal(Type signature) +223 Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action
1 startup) +482 Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action
1 startup) +40 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +70 System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +119 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +523 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +220 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +303[HttpException (0x80004005): Exception has been thrown by the target of an invocation.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +659 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +89 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +188