我在同一台计算机上有两个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;
然后......
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));
当我去让我的电话,我收到上述错误。这是我的监听器的配置文件:
<service behaviorConfiguration="MEX Enabled" name="InvoiceSubscriber">
<endpoint binding="wsHttpBinding"
bindingConfiguration="ReliableTransactionalHTTP"
contract="AtlanticBT.SubscriptionService.Contracts.v1.IAtlanticEvents">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<bindings>
<wsHttpBinding>
<binding name="ReliableTransactionalHTTP" transactionFlow="true">
<reliableSession enabled="true"/>
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm=""/>
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
我检查我的所有ACL在承载服务的目录和他们似乎是正确的。 IIS安全性设置为匿名访问和Windows身份验证。
因此,如果我明确地设置代码中的凭据,为什么我的听众不能进行身份验证?
请求本身可能格式错误。使用Fiddler检查原始请求/响应,以确保您传递的是真正正确的请求。 http://www.fiddler2.com/fiddler2/ – 2009-10-28 21:31:44
Ahh提琴手...我忘了那个小窍门。我会尝试看看。我还必须制定我的身份验证方案。谢谢! – Daryl 2009-10-29 13:20:50