2011-07-28 8 views
3

私が間違っていることが見つかりません。ブートストラップトークンを使用してWCFサービスに正しく接続する方法

私はサービス操作を呼び出すしようとすると、私はエラーを取得する:

通信オブジェクト、それが故障状態であるため、System.ServiceModel.Channels.ServiceChannelは、通信に使用することはできません。 web.configファイルで

using (Ref.SService_V1_0Client client = new Ref.SService_V1_0Client("RWS")) 
{ 
    var request = new Ref.IVISRequestStructure(); 
    request.Header = new Ref.RequestHeaderStructure(); 


    client.ChannelFactory.Credentials.SupportInteractive = false; 
    ChannelFactoryOperations.ConfigureChannelFactory(client.ChannelFactory); 
    ChannelFactoryOperations.CreateChannelWithIssuedToken<Ref.ISService_V1_0>(client.ChannelFactory, ((Microsoft.IdentityModel.Claims.ClaimsIdentity)(Page.User.Identity)).BootstrapToken); 
    client.StartTransaction("string argument"); 
} 

構成:

<system.serviceModel> 
    <bindings> 
    <ws2007FederationHttpBinding> 
     <binding name="ws2007FederationUserName" closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" maxReceivedMessageSize="100000000"> 
     <security mode="TransportWithMessageCredential"> 
      <message issuedKeyType="SymmetricKey" negotiateServiceCredential="true"> 
      <issuer address="adress/STS/Issue.svc/trust/13/issuedtokenmixedsymmetricbasic256" binding="customBinding" bindingConfiguration="issuedtokenmixedsymmetricbasic256"/> 
      </message> 
     </security> 
     </binding> 
    </ws2007FederationHttpBinding> 
    </bindings> 
    <client> 
    <endpoint address="another_address/servicename.svc/ws2007Federation" 
     binding="ws2007FederationHttpBinding" bindingConfiguration="ws2007FederationUserName" 
     contract="Ref.ISService_V1_0" name="RWS" /> 
    </client> 
</system.serviceModel> 

答えて

1

代わりにクライアント変数を使用してのサービスを呼び出すためにCreateChannelWithIssuedToken呼び出しの戻り値を使用してみてください。 CreateChannel code in this sample for how CreateChannelWithIssuedToken is used.をご覧ください。

var serviceClient = ChannelFactoryOperations.CreateChannelWithIssuedToken<Ref.ISService_V1_0>(client.ChannelFactory, ((Microsoft.IdentityModel.Claims.ClaimsIdentity)(Page.User.Identity)).BootstrapToken); 
serviceClient.StartTransaction("string argument"); 
関連する問題