无法加载文件或程序集"Microsoft.Owin.Security.Cookies"或其依赖项之一.

yes*_*man 25 azure

我有一个由Visual Studio 2013制作的新MVC5项目,当我尝试在本地启动它时工作正常.但是,当我发布到我的Azure网站时,我得到了这个头版:

无法加载文件或程序集"Microsoft.Owin.Security.Cookies"或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

并且堆栈跟踪:

[FileLoadException:无法加载文件或程序集'Microsoft.Owin.Security.Cookies'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)]

[FileLoadException:无法加载文件或程序集'Microsoft.Owin.Security.Cookies,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(来自HRESULT的异常:0x80131040)] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,String codeBase,> Evidence assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)+0 System.Reflection. RuntimeAssembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,RunTimeAssembly locationHint,StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)+34 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef,Evidence assemblySecurity,RuntimeAssembly reqAssembly, StackCrawlMark&stackMark,IntPtr pPrivHostBinder,Boolean throwOnFileNotFound,Boolean forIntrospection,Boolean suppressSecurityChecks)+152 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackM ark,IntPtr pPrivHostBinder,Boolean forIntrospection)+77 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark&stackMark,Boolean forIntrospection)+16 System.Reflection.Assembly.Load(String assemblyString)+28 System.Web.Configuration .CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)+38

[ConfigurationErrorsException:无法加载文件或程序集'Microsoft.Owin.Security.Cookies,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(来自HRESULT的异常:0x80131040)] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName,Boolean starDirective)+736 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()+217 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo) ai)+130 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)+170 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()+91 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath,Boolean&isRefAssemblyLoaded)+284 System.Web.Compilation.BuildManager.ExecutePreAppStart()+153 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException)+521

[HttpException(0x80004005):无法加载文件或程序集"Microsoft.Owin.Security.Cookies,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(来自HRESULT的异常:0x80131040)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+9930568 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)+254

我安装了3.0.0版的Microsoft.Owin,它在我的Web.config和packages.config中说了同样的事情.我怎样才能解决这个问题?

Erh*_*Kuo 84

尝试 :

  1. Microsoft.Owin.Security从2.1.0 升级到3.0.0
  2. Microsoft.Owin.Security.Cookies从2.1.0 升级到3.0.0
  3. Microsoft.Owin.Security.OAuth从2.1.0 升级到3.0.0

升级上述软件包后,问题得以解决.

  • 是的,我刚才想到了这个问题并忘记了这个问题.只需重新安装它要求的任何包.感谢您抽出宝贵时间回答! (3认同)