【发布时间】:2009-03-23 20:34:03
【问题描述】:
我有一个使用 Windows 集成安全性的 Web 应用程序。我还有一个作为本地系统运行的 Windows 服务。 Web 应用程序使用 .NET 远程处理通过 tcpip 通道在服务上执行方法。有没有办法在 .NET 2.0 上将 Windows 身份传递给服务?
【问题讨论】:
标签: .net security remoting impersonation
我有一个使用 Windows 集成安全性的 Web 应用程序。我还有一个作为本地系统运行的 Windows 服务。 Web 应用程序使用 .NET 远程处理通过 tcpip 通道在服务上执行方法。有没有办法在 .NET 2.0 上将 Windows 身份传递给服务?
【问题讨论】:
标签: .net security remoting impersonation
根据 MSDN 文档,配置客户端和服务器 app.config 文件。
服务器:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" secure="true" impersonate="true" />
</channels>
</application>
</system.runtime.remoting>
</configuration>
客户:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" secure="true" tokenImpersonationLevel="impersonation"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
请注意,该属性对于服务器称为 impersonate 而对于客户端称为 tokenImpersonationLevel。
见:http://msdn.microsoft.com/en-us/library/59hafwyt(VS.85).aspx
【讨论】: