8

Tridion 2011 SP1 HR1でコアサービスを偽装しようとすると、次のエラーが発生します。

アクション「http://www.sdltridion.com/ContentManager/CoreService/2011/ISessionAwareCoreService/Impersonate」が無効であるか認識されていないため、メッセージを処理できませんでした。

なぜこれが起こるのですか?なぜそれが機能しないのかわからないように私は盲目でなければなりません...

サーバーについて:Tridion 2011SP1HR1の新規インストール

私のコードは次のようになります。

 client = Client.GetCoreService();

 if (string.IsNullOrEmpty(username)) username = HttpContext.Current.User.Identity.Name;
      client.Impersonate(username);

これはGetCoreServiceメソッドです。

public static SessionAwareCoreServiceClient GetCoreService()
{
       AppSettingsReader reader = new AppSettingsReader();

       string coreServiceUrl = (string)reader.GetValue("CoreServiceEndPoint", typeof(string));
       int dataSize = (int)reader.GetValue("DataSize", typeof(int));

       var quotas = new System.Xml.XmlDictionaryReaderQuotas
       {
           MaxStringContentLength = dataSize,
           MaxArrayLength = dataSize,
           MaxBytesPerRead = dataSize
       };

       var httpBinding = new WSHttpBinding
       {
           MaxReceivedMessageSize = 10485760,
           ReaderQuotas = quotas,
           Security = { Mode = SecurityMode.Message, Transport = { ClientCredentialType = HttpClientCredentialType.Windows } }
       };

       var endpoint = new EndpointAddress(coreServiceUrl);
       var result = new SessionAwareCoreServiceClient(httpBinding, endpoint);

       return result;
  }

appsettingsから抽出します(実際のホスト名を「hostname」に置き換えました):

<add key="CoreServiceEndPoint" value="http://hostname/WebServices/CoreService.svc/wsHttp_2010" />
<add key="DataSize" value="41943040" />
4

2 に答える 2

6

必要なことを行う通知については、オープンソースプロジェクトのこのサンプルをご覧ください

http://code.google.com/p/tridion-notification-framework/source/browse/NotificationService/NotificationService/CoreService/Client.cs

これが偽装する作業ラインです

public static SessionAwareCoreServiceClient GetCoreService()
{
    var result = GetNewClient<SessionAwareCoreServiceClient>();


    result.Impersonate(ConfigurationManager.AppSettings.Get("adminUser"));
    return result;
}

また、同じCSファイルのサンプルでクライアントが作成される方法とアプリの設定も確認してください。古いエンドポイントアドレスを使用していると思いますhttp://hostname/webservices/CoreService2011.svc/wsHttphttp://hostname/WebServices/CoreService.svc/wsHttp_2010

于 2012-12-12T12:20:54.147 に答える
3

古いコアサービスのwsHttpエンドポイントに接続しています。

2011 SP1クライアントを使用している場合は、代わりに次のエンドポイントに接続する必要があります。

http://hostname/webservices/CoreService2011.svc/wsHttp

于 2012-12-12T12:45:49.203 に答える