如何通过 .net 远程调用模拟经过 Windows 身份验证的 Web 用户?

发布于 2024-07-15 19:40:24 字数 146 浏览 5 评论 0原文

我有一个使用 Windows 集成安全性的 Web 应用程序。 我还有一个作为本地系统运行的 Windows 服务。 Web 应用程序使用 .NET 远程处理通过 tcpip 通道在服务上执行方法。 在 .NET 2.0 上,有没有办法将 Windows 身份传递给服务?

I have an web application that uses windows integrated security. I also have a windows service that runs as local system. The web application uses .NET remoting to execute a method on the serivce through tcpip channel. Is there a way, on .NET 2.0, to pass the windows identity to the service?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白芷 2024-07-22 19:40:24

根据 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

Per MSDN documentation, configure the client and server app.config files.

Server:

<?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>

Client:

<?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>

Notice that the attribute is called impersonate for the server but tokenImpersonationLevel for the client.

See: http://msdn.microsoft.com/en-us/library/59hafwyt(VS.85).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文