1

I have a website developed in Sitefinity 6.3 that is deployed on windows Azure (website deployed in Cloud Service). Now I have upgraded the project to sitefinity 7.0 as mentioned on their migration page.

Project upgraded successfully, and I followied the steps to remove & add References, but then I ran the project & it showed me following error:

Assembly 'Telerik.Sitefinity, Version=7.0.5100.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' 
uses 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' 
which has a higher version than referenced assembly 

'Microsoft.WindowsAzure.ServiceRuntime, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Then I installed the Azure SDK version 2.2, then following error was displaying:

Could not load file or assembly 'msshrtmi' or one of its 
dependencies. An attempt was made to load a program with an incorrect 
format.


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.BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.

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 'msshrtmi' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = msshrtmi
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: msshrtmi | 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:///C:/user/Projects/TestTime/Code/From Svn/Unpublished/TestTime/
LOG: Initial PrivatePath = C:\user\Projects\TestTime\Code\From Svn\Unpublished\TestTime\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\user\Projects\TestTime\Code\From Svn\Unpublished\TestTime\web.config
LOG: Using host configuration file: C:\Users\Administrator\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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/Framework/v4.0.30319/Temporary ASP.NET Files/root/eaa8f4f5/4dd032f8/msshrtmi.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/eaa8f4f5/4dd032f8/msshrtmi/msshrtmi.DLL.
LOG: Attempting download of new URL file:///C:/user/Projects/TestTime/Code/From Svn/Unpublished/TestTime/bin/msshrtmi.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.


Stack Trace:


[BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   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& stackMark, 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: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
   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) +285
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
   System.Web.HttpRuntime.FirstReques

I tried setting following tag in web.config :

 <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" culture="neutral" publicKeyToken="31bf3856ad364e35"  />
    <bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding

I also copied the related dlls in bin folder & added reference to project. But nothing seemed to work for me, Please let me know where am I going wrong?

Edit: ------------------------

Thanks [DrewG] for sharing important info. I followed all the steps as DrewG mentioned. Then I got error when I ran the project in Visual Studio for Post Build task, then I removed that task & Changed following setting in web.config:

<bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.2.0.0"/>

to

<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.2.0.0"/>

Then it run perfectly, Then I removed the References folder, then It also run perfectly. Now, I could not recognise wht was fixed by DrewG's steps, but after reverting all the steps it's working correct. I would like to know what might be fixed?

Thanks

4

1 回答 1

1

我在本地运行项目时遇到了类似的问题。它正在尝试加载该 dll (msshrtmi.dll) 的 64 位版本。

Azure 需要 .dll 的 64 位版本,但您需要在本地运行时使用 32 位版本,或者您需要在 IIS 中设置一个具有 64 位应用程序池的站点才能在本地进行测试。

我想出了一些技巧来让它在我们的天蓝色网站上工作,但它在升级到 Sitefinity 7 之前和之后一直有效,所以也许它会帮助你。

我将 64 位和 32 位 msshrtmi.dll 文件复制到与 .sln 文件位于同一目录中的名为 References 的文件夹中。然后我编写了一个快速的 .bat 文件并将其添加为通过我当前构建配置文件的项目的构建后任务。

注意:我有一个名为“Azure”的构建配置文件,用于更新其他一些设置,而不是使用迅雷。Azure 构建配置文件基本上只是 Release 的副本,但我也喜欢在本地测试 Release 构建。

构建任务看起来像这样

call $(SolutionDir)References\AZURE.bat $(ConfigurationName) $(SolutionDir)

AZURE.bat 文件看起来像这样

If %1 == Azure echo "Copying 64bit version of msshrtmi.dll"
If %1 == Azure  copy %2\References\64\msshrtmi.dll %2\YourProject\Bin\msshrtmi.dll
If NOT %1 == Azure echo "Copying 32bit version of msshrtmi.dll"
If NOT %1 == Azure  copy %2\References\32\msshrtmi.dll %2\YourProject\Bin\msshrtmi.dll
于 2014-05-14T01:26:41.037 回答