将Sitefinity 6.3(Windows Azure Webproject)升级到Sitefinity 7.0后出现问题

时间:2014-05-13 14:30:53

标签: azure upgrade sitefinity azure-sdk-.net

我有一个在Sitefinity 6.3中开发的网站,该网站部署在Windows Azure(部署在Cloud Service中的网站)上。现在我已将项目升级到sitefinity 7.0,如migration page所述。

项目升级成功,我按照步骤删除&添加引用,但后来我运行了项目&它向我显示以下错误:

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'

然后我安装了Azure SDK 2.2版,然后显示以下错误:

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

我尝试在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

我还在bin文件夹中复制了相关的dll&amp;添加了对项目的引用。 但似乎没有什么对我有用,请让我知道我哪里出错了?

编辑:------------------------

感谢[DrewG]分享重要信息。 我遵循DrewG提到的所有步骤。然后当我在Visual Studio for Post Build任务中运行项目时遇到错误,然后我删除了该任务&amp;更改了web.config中的以下设置:

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

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

然后它运行完美,然后我删除了References文件夹,然后它也完美运行。 现在,我无法识别DrewG的步骤修复了什么,但在恢复所有步骤之后,它的工作正确。 我想知道可能修复的内容?

由于

1 个答案:

答案 0 :(得分:1)

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

Azure需要.dll的64位版本,但是当您在本地运行时需要使用32位版本,或者您需要在IIS中使用64位应用程序池设置站点以便能够在本地进行测试。

我想出了一些在我们的天蓝色网站上运行的黑客攻击,但它在升级到Sitefinity 7之前和之后一直在工作,所以它可能会帮助你。

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

注意:我有一个名为“Azure”的Build配置文件,我用它来更新其他设置而不是使用迅雷。 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