【问题标题】:What would cause a 'could not load file or assembly' error concerning 'Microsoft.WindowsAzure.Configuration'?什么会导致有关“Microsoft.WindowsAzure.Configuration”的“无法加载文件或程序集”错误?
【发布时间】:2012-07-31 12:04:20
【问题描述】:

我一直在开发一个多层 Azure 应用程序。它使用 MVC 前端背后的 Web 和辅助角色,以及 Azure SQL 和表存储。一段时间以来,它在模拟器和云中都运行良好。

我刚刚开始向它添加一些服务总线功能,从 NuGet 添加服务总线包,现在我发现虽然一切仍然可以编译,但我收到以下运行时错误:

Server Error in '/' Application.
Could not load file or assembly 'Microsoft.WindowsAzure.Configuration' 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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration' 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)

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.WindowsAzure.Configuration' could not be loaded.


=== Pre-bind state information ===
LOG: User = JCFXLAPTOP\User
LOG: DisplayName = Microsoft.WindowsAzure.Configuration
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.WindowsAzure.Configuration | Domain ID: 2
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///D:/Work/CLIENTS/PageEngine/Solutions/PageEngine/Web.PageEngine/
LOG: Initial PrivatePath = D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\Web.PageEngine\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\Web.PageEngine\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/4904ccbc/14659c77/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET Files/root/4904ccbc/14659c77/Microsoft.WindowsAzure.Configuration/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Attempting download of new URL file:///D:/Work/CLIENTS/PageEngine/Solutions/PageEngine/Web.PageEngine/bin/Microsoft.WindowsAzure.Configuration.DLL.
LOG: Using application configuration file: D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\Web.PageEngine\web.config
LOG: Using host configuration file: C:\Program Files\IIS Express\config\templates\PersonalWebServer\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
ERR: Failed to complete setup of assembly (hr = 0x80131045). Probing terminated.


Stack Trace:


[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration' 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)]

[FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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)]
   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.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +210
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +242
   System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +17
   System.Reflection.Assembly.Load(String assemblyString) +35
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +122

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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)]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +12731430
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +503
   System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +142
   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +334
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +203
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +152
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +1151

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.WindowsAzure.Configuration, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 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)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12847312
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12675965

我注意到 ServiceBus NuGet 包引用了较新版本的 Microsoft.WindowsAzure.Configuration dll (1.7.0.2),并想知道这是否可能是原因。我已经尝试覆盖它并将所有引用更改为 1.7.0.0 或 1.7.0.2 - 更改都没有帮助。我还尝试从解决方案中删除所有 Azure 引用,并通过安装 NuGet 包和引用最新的 SDK 重新添加引用。这也没有帮助。

我应该补充一点,Microsoft.WindowsAzure.Configuration dll 始终位于 MVC 应用程序的 bin 文件夹中,并且始终将 CopyLocal 设置为 true。

我注意到最近(7 月 27 日星期五)更新了 Azure 配置 NuGet 包,我想知道这是否与它有关。

有人知道问题出在哪里吗?

编辑

只是为了确认删除服务总线 nuget 包可以解决问题。恢复它会导致问题再次出现。我不知道这是否重要,但作为 NuGet 包的一部分添加的 Microsoft.WindowsAzure.Configuration dll 似乎具有不一致的版本号。虽然路径表明版本应该是 1.7.0.2:

D:\Work\CLIENTS\PageEngine\Solutions\PageEngine\packages\Microsoft.WindowsAzure.ConfigurationManager.1.7.0.2\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll

...属性检查器中的版本号仍然是1.7.0.0

【问题讨论】:

    标签: dll azure servicebus


    【解决方案1】:

    这是 Microsoft.WindowsAzure.Configuration 程序集版本 1.7.0.2 的问题

    通过回滚到 1.7.0.1 或 1.7.0.0 暂时修复,然后在 1.7.0.3 中永久修复

    【讨论】:

      【解决方案2】:

      有同样的问题。我将 Microsoft.WindowsAzure.ConfigurationManager 恢复为 NuGet 版本 1.7.0.1。现在一切正常。

      【讨论】:

      • 感谢您花时间回答。我通过从 NuGet 获取最新的服务总线包然后删除对 1.7.0.2 的所有引用并手动引用 1.7.0.0 以类似的方式进行修复。不过,我会留下这个问题,因为我想看看社区中是否有人可以说出为什么会发生这种情况。
      • 谢谢 - 同时我正在让团队对此进行调查。很抱歉!
      • 我们今天下午有一个修复程序正在传播到 NuGet。
      • 感谢杰夫的及时关注。您想将其放入答案中,以便我可以将其标记为这样,以防将来有人偶然发现此问题?
      • 已试用 1.7.0.3 版,工作正常。感谢@Jeff 的快速响应。
      猜你喜欢
      • 2016-04-13
      • 1970-01-01
      • 1970-01-01
      • 2010-10-07
      • 2023-03-05
      • 1970-01-01
      • 1970-01-01
      • 2013-02-23
      相关资源
      最近更新 更多