10

刚刚将VS2015与VS2010并排安装...

有问题的应用程序是使用 VS2010 构建的(设置为使用 .Net 4.0)(未迁移到 VS2015)在我的机器上运行良好,将它放在服务器上并倒在一堆...... stdole 是问题......

在错误 Windows 日志 > 应用程序中有一个异常:

Exception information: 
Exception type: ConfigurationErrorsException 
Exception message: Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
   at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
   at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
   at System.Web.Compilation.BuildManager.ExecutePreAppStart()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at     System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.Load(String assemblyString)
   at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)

Could not load file or assembly 'stdole' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

Stack trace:    at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
   at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
   at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
   at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
   at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
   at System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded)
   at System.Web.Compilation.BuildManager.ExecutePreAppStart()
   at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

查看对 stdole 的引用,它是对 GAC 和版本:2.0.0.0

什么都没有改变。

这个错误到底是从哪里来的?

4

4 回答 4

6

以防万一其他人遇到与我相同的问题...

这就是我解决问题的方式:

删除了对 stdole 的现有引用,然后添加了一个引用 > 扩展 > stdole 有四个条目!一个带有 office 图标,一个带有 VS 图标,一个带有 cog(设置图标),另一个没有图标(所有四个都是完全相同的版本号等)...

添加了对带有 VS 图标的引用并部署到服务器...一切顺利(触摸木头)

于 2016-02-18T10:52:41.843 回答
1

在您的项目中添加对“stdole.dll”的引用,它可以在几个不同的地方找到

  • 你的 GAC (C:\Windows\assembly)
  • C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies

重建,重新部署,一切都应该很好。

于 2017-02-13T05:08:05.733 回答
1

现在有一个 Nuget 包,它提供stdole.dll

https://www.nuget.org/packages/stdole

因此,如果您不想假设它在 GAC 中或者您需要特定版本,那么今天这可能是将其包含在您的项目中的最可靠方式。有些版本从 17.0.0(预览版)一直到 7.0.3300,尽管不是连续的。(不确定他们是否跳过了版本号,或者是否确实缺少某些版本号?)

于 2021-05-28T12:25:35.940 回答
0

您可能想探究为什么 stdole 库(或其依赖项之一)已被篡改。

同时,sn -Vr *在命令提示符下运行命令以禁用本地计算机上的完整性检查。

于 2016-02-18T10:52:41.750 回答