【发布时间】:2010-12-29 15:30:27
【问题描述】:
我有一个自托管 Wcf 服务的 Windows 服务,这个 Wcf 服务有一个带有默认设置的 tcpBinding。 Windows 服务作为 LocalSystem 运行。
Wcf 服务由在 IIS 7.5 集成管道中运行的 Web 应用程序引用(默认设置),该应用程序在其自己的应用程序池中具有自己的标识。
两者都在同一台机器上运行。
一切正常,除了当我在 Wcf 服务中检查当前线程的身份时:
Thread.CurrentPrincipal.Identity.Name
它返回 Web 应用程序的应用程序池的用户。这不是我所期望的。看起来 Wcf 服务中正在进行某种模拟。
这是标准行为吗?我找不到任何关于此的文档。 这是否意味着当我尝试访问 Wcf 服务中的数据库时,我正在引入身份跃点?
编辑,服务端的配置:
Type serviceType = typeof(WcfService);
host = new ServiceHost(serviceType);
Binding tcpBinding = new NetTcpBinding( );
Uri tcpBaseAddress = new Uri("net.tcp://localhost:8001/Test");
host.AddServiceEndpoint(typeof (WcfService), tcpBinding, tcpBaseAddress);
host.Open();
在客户端:
NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.Transport);
windowsService = new WindowsService.WcfServiceClient(tcpBinding, new EndpointAddress("net.tcp://localhost:8001/Test"));
【问题讨论】:
标签: wcf iis wcf-security