小编Dar*_*ryl的帖子

WCF:无法满足安全令牌请求,因为身份验证失败

我在同一台机器上有两个WCF服务.一个是出版商,一个是听众.

发布者基于和端点动态创建代理.我在这样的代码中配置代理:

            WSHttpBinding binding = new WSHttpBinding(SecurityMode.Message, true);
            binding.Security.Message.NegotiateServiceCredential = true;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
            binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
            binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
            binding.Security.Message.EstablishSecurityContext = true;
            binding.ReliableSession.Enabled = true;
            binding.TransactionFlow = true;
            return binding;
Run Code Online (Sandbox Code Playgroud)

然后...

            Binding binding = GetBindingFromAddress(address);

            ChannelFactory<T> factory = new ChannelFactory<T>(binding);
            factory.Credentials.UserName.UserName = "an account on the machine";
            factory.Credentials.UserName.Password = "a password for that account";

            T proxy = factory.CreateChannel(new EndpointAddress(address));
Run Code Online (Sandbox Code Playgroud)

当我去打电话时,我收到上述错误.这是我的监听器配置文件:

   <service behaviorConfiguration="MEX Enabled" name="InvoiceSubscriber">
<endpoint binding="wsHttpBinding"
          bindingConfiguration="ReliableTransactionalHTTP"
          contract="AtlanticBT.SubscriptionService.Contracts.v1.IAtlanticEvents">
 <identity>
  <dns value="localhost" />
 </identity>
</endpoint>
Run Code Online (Sandbox Code Playgroud)

        <bindings>
        <wsHttpBinding>
            <binding name="ReliableTransactionalHTTP" transactionFlow="true"> …
Run Code Online (Sandbox Code Playgroud)

c# wcf wshttpbinding channelfactory .net-3.5

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

.net-3.5 ×1

c# ×1

channelfactory ×1

wcf ×1

wshttpbinding ×1