Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何使用引导令牌正确连接到WCF服务_.net_Wcf_Wif - Fatal编程技术网

.net 如何使用引导令牌正确连接到WCF服务

.net 如何使用引导令牌正确连接到WCF服务,.net,wcf,wif,.net,Wcf,Wif,我找不到我做错了什么 当我尝试调用服务操作时,出现错误: 通信对象System.ServiceModel.Channels.ServiceChannel无法用于通信,因为它处于故障状态 using (Ref.SService_V1_0Client client = new Ref.SService_V1_0Client("RWS")) { var request = new Ref.IVISRequestStructure(); request.Header = new

我找不到我做错了什么

当我尝试调用服务操作时,出现错误:

通信对象System.ServiceModel.Channels.ServiceChannel无法用于通信,因为它处于故障状态

    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");
}
使用(Ref.SService\u V1\u 0客户端=新的Ref.SService\u V1\u 0客户端(“RWS”))
{
var请求=新的参考IVISRequestStructure();
request.Header=新的Ref.RequestHeaderStructure();
client.ChannelFactory.Credentials.SupportInteractive=false;
ChannelFactoryOperations.ConfigureChannelFactory(客户端.ChannelFactory);
ChannelFactoryOperations.CreateChannelWithIssuedToken(client.ChannelFactory,((Microsoft.IdentityModel.Claims.ClaimsIdentity)(Page.User.Identity)).BootstrapToken);
client.StartTransaction(“字符串参数”);
}
web.config中的配置:

 <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>

尝试使用CreateChannelWithIssuedToken调用的返回值来调用服务,而不是使用客户端变量。请参见以下内容:

var serviceClient = ChannelFactoryOperations.CreateChannelWithIssuedToken<Ref.ISService_V1_0>(client.ChannelFactory, ((Microsoft.IdentityModel.Claims.ClaimsIdentity)(Page.User.Identity)).BootstrapToken);
serviceClient.StartTransaction("string argument");
var serviceClient=ChannelFactoryOperations.CreateChannelWithIssuedToken(client.ChannelFactory,((Microsoft.IdentityModel.Claims.ClaimsIdentity)(Page.User.Identity)).BootstrapToken);
serviceClient.StartTransaction(“字符串参数”);