我如何通过.NET远程调用来模仿Windows认证的Web用户?
-
21-08-2019 - |
题
我有一个使用Windows集成安全性的Web应用程序。我还有一个作为本地系统运行的Windows服务。 Web应用程序使用.NET远程通过TCPIP频道在销售中执行方法。在.NET 2.0上有没有办法将Windows标识传递给服务?
解决方案
根据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>
请注意,该属性被称为服务器的假名,但对于客户端的tokenimpersonationlevel。
看: http://msdn.microsoft.com/en-us/library/59hafwyt(vs.85).aspx
不隶属于 StackOverflow