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

标签 azure upgrade sitefinity azure-sdk-.net

我有一个在 Sitefinity 6.3 中开发的网站,部署在 Windows Azure 上(网站部署在云服务中)。现在我已将项目升级到 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,版本=1.8.0.0,文化=中性,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 并添加了对项目的引用。 但似乎没有什么对我有用,请让我知道我哪里出了问题?

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

感谢 [DrewG] 分享重要信息。 我按照 DrewG 提到的所有步骤进行操作。然后,当我在 Visual Studio 中运行项目以进行构建后任务时出现错误,然后我删除了该任务并更改了 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 的步骤修复了什么,但在恢复所有步骤后,它工作正常。 我想知道哪些问题可以修复?

谢谢

最佳答案

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

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

我想出了一些技巧来让它在我们的 azure 网站上运行,但它在升级到 Sitefinity 7 之前和之后一直在运行,所以也许它会对您有所帮助。

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

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

关于azure - 将 Sitefinity 6.3(Windows Azure Webproject)升级到 Sitefinity 7.0 后出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23634137/

相关文章:

azure - 是否可以在 Azure Devops 管道中将模板作为 stepList 参数传递?

azure - NET 5 MVC 6 - 发布到 Azure 网站 ERROR_COULD_NOT_FIND_APPROOT_FOLDER

installation - 安装最新版本的 gmsh

ssl - Sitefinity 需要 SSL

css - 在 .NET 服务器之间移动 CSS 文件困难吗?

azure - 没有从 Web 角色托管的 Sitefinity CMS 收集 Application Insights 数据

c# - Multi-Tenancy : Individual database per tenant

azure - 通过 Startup.cs 添加依赖项注入(inject)到 Azure Functions 会导致主机错误

elasticsearch - Elasticsearch 2.x索引映射_id

database - Meteor 如何执行数据库迁移?