无法加载文件或程序集“msshrtmi”或它的某一个依赖(Azure的表存储访问)它的、加载、文件、程序

由网友(一懒众衫小)分享简介:我有我使用重定向在我的数据中心网站和Azure平台上运行的网站之间的流量的HTTP模块。该HTTP模块从Azure的表存储检索它的重定向规则。I have an HTTPModule that I use to redirect traffic between a website in my data center...

我有我使用重定向在我的数据中心网站和Azure平台上运行的网站之间的流量的HTTP模块。该HTTP模块从Azure的表存储检索它的重定向规则。

I have an HTTPModule that I use to redirect traffic between a website in my data center and a website running on the Azure platform. This HTTPModule retrieves its redirect rules from Azure Table Storage.

重定向工作正常在我的本地dev的机器,以及在Azure上运行时。然而,当我在模块部署到我的数据中心服务器(IIS 7,WS 2008 R2标准64位,.NET 4.0,ASP.NET 4.0)我收到以下错误

Redirects work fine on my local dev machine as well as when running on Azure. However, when I deploy the module to my data center servers ( IIS 7, WS 2008 R2 Standard 64bit, .NET 4.0, ASP.NET 4.0 ) I receive the following error

Parser Error Message: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Line 124:                <add assembly="System.Web.DynamicData, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 125:                <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
Line 126:                <add assembly="*" />
Line 127:            </assemblies>
Line 128:            <buildProviders>

Source File: C:WindowsMicrosoft.NETFrameworkv4.0.30319Configweb.config    Line: 126 

msshrtmi.dll实际存在于我的部署bin目录。

"msshrtmi.dll" actually exists in my deployment bin directory.

如果我删除此DLL的数据中心站点工作正常,但但HTTP模块加载失败,从表存储的配置数据,而不是引发以下错误

If I remove this dll the data center site works fine but but the HTTPModule fails to load its configuration data from Table Storage and instead throws the following error

---> System.TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'msshrtmi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable()

另外,我已经手动列入Microsoft.WindowsAzure.ServiceRuntime.dll作为部署的一部分,以确保它是可用的数据中心的服务器上。

Also, I have manually included "Microsoft.WindowsAzure.ServiceRuntime.dll" as part of the deployment to ensure it is available on the data center servers.

推荐答案

看来,Azure的项目是该特定文件非常敏感。从:http://social.msdn.microsoft.com/Forums/en-US/windowsazuretroubleshooting/thread/0fac1f05-eb55-432f-80ac-6f15cde5b14b/

It seems that Azure projects are very sensitive to that particular file. From: http://social.msdn.microsoft.com/Forums/en-US/windowsazuretroubleshooting/thread/0fac1f05-eb55-432f-80ac-6f15cde5b14b/

当你重建为Web角色项目,请问您检查   如果在bin文件夹中的msshrtmi.dll文件或不?如果是,那么请   检查它是否是使用的Dependency Walker 64位或32位。如果是32位,   请尝试以下任一选项为prevent这允许输出   DLL文件到bin文件夹。

When you do a rebuild for the web role project, may I ask you to check if a msshrtmi.dll file in the bin folder or not? If yes, then please check if it is 64bit or 32bit using Dependency Walker. If it is 32bit, please try either of the following options to prevent outputing this dll file to bin folder.   

目标Web角色项目x64和重新湛蓝的服务项目。此选项是通过确定    http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/286cecf6-1423-4ef3-93f9-0eb8a67d8192. (编辑:截至2 '12现在是死链接)

Target the web role project to x64 and recreate the azure service project. This option was confirmed by http://social.msdn.microsoft.com/Forums/en/windowsazure/thread/286cecf6-1423-4ef3-93f9-0eb8a67d8192. (edit: now a dead link as at February '12.)

打开使用记事本网站项目文件和所有配置属性组中删除PlatformTarget元素。本   选项​​转引自   http://tomkrueger.word$p$pss.com/2010/07/27/azure-deployment-issue-after-upgrading-to-visual-studio-2010-and-net-4-0/.

Open the web site project file using Notepad and remove the PlatformTarget element from all configuration property groups. This option is quoted from http://tomkrueger.wordpress.com/2010/07/27/azure-deployment-issue-after-upgrading-to-visual-studio-2010-and-net-4-0/.

写生成后事件命令删除msshrtmi.dll时成功地执行生成操作。要做到这一点,请右键单击   Web角色项目,并选择属性。选择生成事件选项卡,   在生成后事件命令行文本框中,输入以下   命令:

Write Post-build event command to delete msshrtmi.dll when a build action is successfully performed. To do this, please right click the web role project and select Properties. Select the Build Events tab, in the "Post-build event command line" textbox, input the following command:

CD $(TARGETDIR)   德尔msshrtmi.dll

这一切表明,你要检查是否已建立在目标环境中正确的配置进行部署。请确保你已经针对性​​的x64部署到数据中心的服务器。

This all suggests that you'll want to check that you've built the correct configuration for deployment on your target environment. Make sure you've targetted x64 for deployment to your data centre servers.

阅读全文

相关推荐

最新文章