English 中文(简体)
WCF和通过窗口证书
原标题:WCF and passing windows credentials
  • 时间:2009-08-31 09:51:15
  •  标签:

我在服务器A上设有一个网站,利用一个应用库,利用一个有域名的专用用户,进入我们的数据库。 在网站的汇辑中,我具体说明:

    <identity impersonate="true" />

然后,我还在服务器A上服务,在比照方案(即没有立案)的奥塞莱特担任东道。

Uri uri = new Uri("net.tcp://ServerA:9900/Service/");

ServiceHost host = new ServiceHost(typeof(Service1), uri);

NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

ServiceEndpoint serviceEndpoint = host.AddServiceEndpoint(typeof(IService1), binding, uri);
EndpointAddress myEndpointAddress = new EndpointAddress(uri, EndpointIdentity.CreateSpnIdentity("MyspnName"));
serviceEndpoint.Address = myEndpointAddress;

host.Open();

当我在当地机器上开一个浏览器并上网站时,网站试图与世界功能和功能数据库服务器连接,并回去“由于认证失败,无法满足安全要求”错误。

该网站使用以下代码连接服务:

Uri uri = new Uri("net.tcp://ServerA:9900/Service/");

NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

EndpointIdentity epid = EndpointIdentity.CreateSpnIdentity("MyspnName");
EndpointAddress endPoint = new EndpointAddress(uri, epid);
//EndpointAddress endPoint = new EndpointAddress(uri);

ChannelFactory<IService1> channel = new ChannelFactory<IService1>(binding, endPoint);
channel.Credentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Delegation;
IService1 service = channel.CreateChannel();

service.PrintMessage("Print this message!");

关于骑自行车,我尝试了

当我利用当地人管理网站时,没有错误,而且网站是完美的。 在我网站上,我也改变了身份认同感。 编织它,但我的窗户证书没有被带入作为整个点的WCF服务。

我所不知的任何想法? 我也许已经读了这段话。

非常感谢

问题回答

如果你使用Windows认证,你可以在此看到打电话者的身份:

 ServiceSecurityContext.Current.WindowsIdentity

这个WindowsIdentity包含诸如“Name”财产、用户所属所有群体的“团体”财产等内容。

如果WindowsIdentity应为NUL,那么你实际上不会出现视窗认证。

您是否担任过国际科学学会的会员? 哪一种版本——IIS7是第一个支持具有约束力的净额。

如果你自己在ole子里主持了你的工作,那么Windows认证工作又做了什么? 在这种情况下,很可能是国际空间法学会7类混杂问题。

页: 1

I suspect this is because your service account is not trusted for delegation. It can therefore impersonate the caller for access to local resources, but not for calling out over TCP. Google "Trusted for delegation" for more info.





相关问题