Azure的SDK在生产2.2:无法加载文件或程序集“msshrtmi”或它的某一个依赖。该系统找不到指定的文件 [英] Azure SDK 2.2 in Production: Could not load file or assembly 'msshrtmi' or one of its dependencies. The system cannot find the file specified

查看:367
本文介绍了Azure的SDK在生产2.2:无法加载文件或程序集“msshrtmi”或它的某一个依赖。该系统找不到指定的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了一下双方的计算器和其他网站其他几个线程这个问题。没有任何其他解决方案,解决了我的问题,而且大多数是过时的,引用旧版本的Azure SDK的。

I have read about this problem on several other threads both on StackOverflow and other sites. None of the other solutions have solved my problem and most are outdated, referencing old versions of the Azure SDK.

我已经部署了天青使用 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener 来记录跟踪消息一个典型的Azure网站的作用。当跟踪发生时,它看起来好像 DiagnosticMonitorTraceListener 使用 RoleEnvironment 类,后者又尝试加载显然非-existent msshrtmi.dll 。这里是堆栈跟踪正被记录到文件系统中的Azure中的部分内容:

I have a typical Azure website role deployed to Azure that uses Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener to log trace messages. When tracing occurs, it appears as though DiagnosticMonitorTraceListener is using the RoleEnvironment class, which in turn tries to load the apparently non-existent msshrtmi.dll. Here is a portion of the stack trace that is being logged to the file system in Azure:

[FileNotFoundException: Could not load file or assembly 'msshrtmi, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
   Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() +0
   Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() +747

[TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.]
   Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() +0
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +23
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34

[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
   System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +9004943
   System.Diagnostics.TypedElement.BaseGetRuntimeObject() +110
   System.Diagnostics.ListenerElement.GetRuntimeObject() +989
   System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +252
   System.Diagnostics.TraceInternal.get_Listeners() +331
   System.Diagnostics.TraceInternal.WriteLine(String message) +161
   Microsoft.WindowsAzure.AzureApplicationSettings..ctor() +437
   Microsoft.WindowsAzure.CloudConfigurationManager.get_AppSettings() +137
   Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting(String name) +27
   TankSoft.EverMarket.EverMarketPrereleaseRole.Endpoints.Api.Notify..ctor() +40
   lambda_method(Closure , Object[] ) +60
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +315

各个线程都提到我是多么需要从我的bin文件夹清理这个DLL,但该DLL不被复制摆在首位。我怀疑这是同在的Azure SDK 2.2,而不是1.x的运行我我知道我可以直接引用的DLL,但我觉得我不应该这样做是为了要部署的是一个很正常的项目天青。为什么微软不自动检测到我的项目需要这个文件,并部署了正确的文件给我吗?这是郁闷了。

Various threads have mentioned how I need to clean this DLL from my bin folder, but the DLL is not being copied in the first place. I suspect this has to do with me running under Azure SDK 2.2 and not 1.x. I realize I can reference the DLL directly but I feel that I should not have to do this in order to deploy what is a quite normal project to Azure. Why is Microsoft not automatically detecting that my project requires this file and deploying the correct file for me? This is maddening.

我还要说,这个项目我是出版的不是云服务的,而是一个普通的Azure网站项目。

Let me also say that the project I am publishing is not a Cloud Service but rather a regular Azure website project.

有没有人的运行的Azure SDK 2.X 的管理来解决这个问题?什么是你跟着?的具体步骤

Has anyone running Azure SDK 2.x managed to solve this issue? What were the exact steps you followed?

推荐答案

这感觉就像一个黑客,但它是我能想到的唯一的办法来解决这个问题。

This feels like a hack but it was the only way I could think of to solve this issue.

  1. 为解决开放式配置管理器
  2. 选择调试解决方案配置
  3. 创建一个新的解决方案平台,为64
  4. 对于每个Web角色和辅助角色的项目,设置平台到x64
  5. 删除任何CPU解决方案平台
  6. 请同样的更改,发布配置
  7. 添加引用 C:\ Program Files文件\微软的SDK \ Windows Azure的\ .NET SDK \ 2.2 \ BIN \运行时间\基地\ 64 \ msshrtmi.dll
  8. 设置复制本地在新的参考
  1. Open Configuration Manager for the solution
  2. Select the Debug solution configuration
  3. Create a new solution platform for x64
  4. For each web role and worker role project, set the platform to x64
  5. Remove the Any CPU solution platform
  6. Make the same changes to the Release configuration
  7. Add a reference to C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.2\bin\runtimes\base\x64\msshrtmi.dll
  8. Set Copy Local on the new reference to True

修改:我最终取出code被检查RoleEnvironment;相反,我依靠的Web.config / App.config的转换修改的行为在运行时。这消除了对msshrtmi.dll的依赖。

EDIT: I ended up removing the code that was checking RoleEnvironment; instead, I'm relying on Web.config/App.config transforms to modify behavior at runtime. This removes the dependency on msshrtmi.dll.

这篇关于Azure的SDK在生产2.2:无法加载文件或程序集“msshrtmi”或它的某一个依赖。该系统找不到指定的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆