【问题标题】:Error when accessing Core Service from a client machine从客户端计算机访问核心服务时出错
【发布时间】:2012-04-16 22:22:03
【问题描述】:

我正在使用 SDL Tridion 2011 上的核心服务,从客户端计算机连接到 Tridion 服务器。我在尝试执行时遇到了一些错误。

示例代码

namespace coreservice1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                using (ChannelFactory<ISessionAwareCoreService> factory =  new ChannelFactory<ISessionAwareCoreService>("wsHttp_2011"))
                {

                    ISessionAwareCoreService client = factory.CreateChannel();
                    ComponentData comp = (ComponentData)client.Create(component, new ReadOptions());

                    ...

                    //steps to create component                

               }
            }
            catch (Exception ex)
            {
                Response.Write(ex.StackTrace);
                Response.Write("exception is " + ex.Message);
            }
         }
    }
}

我的 wsHttp_2011 的 web.config 是

<wsHttpBinding>
    <binding name="wsHttp" transactionFlow="true" maxReceivedMessageSize="10485760">
        <readerQuotas maxStringContentLength="10485760" maxArrayLength="10485760"/>
            <security mode="Message">
                <message clientCredentialType="Windows"/>
            </security>


<endpoint name="wsHttp_2011" address="http://serveraddress:1000/webservices/CoreService2011.svc/wsHttp" binding="wsHttpBinding" bindingConfiguration="wsHttp" contract="Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService">
    <identity>
        <dns value="serveraddress"/>
    </identity>
</endpoint>

错误:

Server Error in '/' Application. 
________________________________________
Could not load file or assembly 'Tridion.Logging' or one of its dependencies. Strong name signature could not be verified.  The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045) 

我的客户端代码引用了 Tridion.Logging。这个程序集存在于我的代码中。无论它是否存在,我都会收到错误消息。我在客户端代码中引用的DLL版本与服务器中的完全相同。

谁能帮忙,我需要做些什么改变?

我还检查了 tridion 服务器中的事件日志。我没有发现那里添加了任何日志。

代码在服务器机器上执行时运行良好。

来自客户端机器的事件查看器日志如下所示:

配置错误异常

无法加载文件或程序集“Tridion.Logging, Version=6.1.0.25, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b”或其依赖项之一。无法验证强名称签名。该程序集可能已被篡改,或者它被延迟签名但未使用正确的私钥完全签名。 (来自 HRESULT 的异常:0x80131045)在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) 在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)在 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) 在 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() 在 System.Web.Compilation.BuildManager.CallPreStartInitMethods() 在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager、IApplicationHost appHost、IConfigMapPathFactory configMapPathFactory、HostingEnvironmentParameters hostingParameters、PolicyLevel policyLevel、异常 appDomainCreationException) 无法加载文件或程序集“Tridion.Logging, Version=6.1.0.25, Culture=neutral, PublicKeyToken=ddfc895746e5ee6b”或其依赖项之一。无法验证强名称签名。该程序集可能已被篡改,或者它被延迟签名但未使用正确的私钥完全签名。 (来自 HRESULT 的异常:0x80131045)在 System.Reflection.RuntimeAssembly._nLoad(AssemblyName 文件名,字符串 codeBase,证据 assemblySecurity,RuntimeAssembly locationHint,StackCrawlMark 和 stackMark,布尔 throwOnFileNotFound,布尔 forIntrospection,布尔suppressSecurityChecks)在 System.Reflection.RuntimeAssembly.nLoad(AssemblyName System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark & stackMark, Boolean for Introspection, Boolean suppressSecurityChecks) 在 System. System.Web.Configuration.CompilationSect 的 System.Reflection.Assembly.Load(String assemblyString) 的 Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) ion.LoadAssemblyHelper(String assemblyName, Boolean starDirective) 无法加载文件或程序集“Tridion.Logging”或其依赖项之一。无法验证强名称签名。该程序集可能已被篡改,或者它被延迟签名但未使用正确的私钥完全签名。 (HRESULT 异常:0x80131045)
在 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) 在 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() 在 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) 在 System.Web.Compilation。 BuildManager.GetReferencedAssemblies(CompilationSection compConfig) 在 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() 在 System.Web.Compilation.BuildManager.CallPreStartInitMethods() 在 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory , HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)

我在服务器的日志中没有找到任何事件。

【问题讨论】:

  • 您看到的异常,是在服务器端的客户端上吗?您在事件日志中看到任何内容吗?你能指定你使用的是什么操作系统和架构吗?您使用的是服务引用还是 CoreService.dll?你的客户端和服务器在同一台机器上吗?
  • 我正在使用 Coreservice.dll。我的客户端与服务器不同。它不同。
  • 使用 Tridion.ContentManager.CoreService.Client;使用 Tridion.ContentManager.ContentManagement.Fields;使用 Tridion.ContentManager.CommunicationManagement;使用 Tridion.ContentManager.ContentManagement;使用 System.Text;使用 Tridion.ContentManager.CoreService;使用 System.ServiceModel.Channels;使用 System.IO;使用 System.Collections;使用 System.Text.RegularExpressions;
  • 您的客户端代码是否引用了 Tridion.Logging?该程序集是否存在于客户端计算机上?
  • 您在客户端代码中引用的 DLL 版本是否与服务器上的完全相同?

标签: tridion


【解决方案1】:

您不应引用 Tridion.Logging。 CoreService 不需要它。您只需要CoreService.dll。此外,Tridion.Logging 不是公共 API,因此根本不应该使用

【讨论】:

  • 确保您引用的唯一 Tridion 程序集是 CoreService.dll
  • 错误不是缺少 Tridion.Logging,而是缺少“它的一个依赖项”——即 Tridion。正如 user978511 所说,确保您只使用 CoreService 客户端 dll。
  • 运气不好。即使删除了除 CoreService 客户端 dll 之外的 dll,我也面临同样的错误。
  • @muzimil 是服务器端错误吗?您能在服务器上的 Tridion 或 Tridion Content Manager 事件日志中看到任何内容吗?
【解决方案2】:

检查 Tridion 事件日志。还要确保您没有使用任何其他 Tridion 程序集。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-30
    • 2016-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-14
    相关资源
    最近更新 更多