找到的程序集的清单定义与程序集引用不匹配:HRESULT的异常:0x80131040

时间:2019-05-14 10:03:52

标签: package owin .net-assembly

在我的项目中,microsoft.owin的版本为3.1.0.0,但它要求使用较旧的版本 2.1.0.0。我尝试安装microsoft.owin,但没有成功。我的项目 框架是4.5.2。我尝试安装此程序集的nuget软件包,但未安装。谁能告诉我如何解决这个错误。如何安装软件包2.1.0.0版本。我试图将其重定向,但存在相同的错误。

   ERROR

   Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0,       Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.       The located assembly's manifest definition does not match the assembly  reference. (Exception from HRESULT: 0x80131040)

源错误:

        Line 65:             //    ClientSecret = ""
        Line 66:             //});
        Line 67:         }
        Line 68:     }
        Line 69: }
        === Pre-bind state information ===
        LOG: DisplayName = Microsoft.Owin, Version=2.1.0.0, Culture=neutral,  PublicKeyToken=31bf3856ad364e35
        (Fully-specified)
        LOG: Appbase = file:///C:/xxxx/yyyy/uuuu/ldap/
        LOG: Initial PrivatePath = C:\xxxx\yyyy\uuuu\ldap\bin
        Calling assembly : Microsoft.AspNet.Identity.Owin, Version=2.0.0.0,      Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
        LOG: This bind starts in default load context.
        LOG: Using application configuration file: C:\xxxx\yyyy\uuuu\ldap\web.config
        LOG: Using host configuration file: \\xyz.df.xcxc.com\sdsds\yuyuy\****\My Documents\IISExpress\config\aspnet.config
        LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
        LOG: Post-policy reference: Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
        LOG: Attempting download of new URL file:///C:/Users/****/AppData/Local/Temp/Temporary ASP.NET Files/root/b0f32b6a/7c9b41cc/Microsoft.Owin.DLL.
        LOG: Attempting download of new URL file:///C:/Users/****/AppData/Local/Temp/Temporary ASP.NET Files/root/b0f32b6a/7c9b41cc/Microsoft.Owin/Microsoft.Owin.DLL.
        LOG: Attempting download of new URL file:///C:/xxxx/yyyy/uuuu/ldap/bin/Microsoft.Owin.DLL.
        WRN: Comparing the assembly name resulted in the mismatch: Major Version
        ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 

堆栈跟踪:

          [FileLoadException: Could not load file or assembly 'Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
   ldap.Startup.ConfigureAuth(IAppBuilder app) in C:\xxxx\yyyy\uuuu\ldap\App_Start\Startup.Auth.cs:67
   ldap.Startup.Configuration(IAppBuilder app) in C:\xxxx\yyyy\uuuu\ldap\Startup.cs:9

         [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) +128
         System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
   Owin.Loader.<>c__DisplayClass12.<MakeDelegate>b__b(IAppBuilder builder) +93
         Owin.Loader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder) +212
         Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +873
         Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +51
         Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +101
         System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
         Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
         System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
         System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
              System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
          System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

          [HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
          System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
          System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
          System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

请帮助解决此问题。如何安装旧版本的microsoft.owin。

1 个答案:

答案 0 :(得分:1)

一种解决方案是降级您的Microsoft.Owin版本。

  1. 在Visual Studio中右键单击您的项目。
  2. 选择“管理Nuget软件包...”。
  3. 在“安装”下,选择“ Microsoft.Owin”。
  4. 在“版本”下拉列表中,选择2.1.0
  5. 点击“更新”。

enter image description here