更改程序集运行的标识
我有一个从我的 asp.net 网站中调用的程序集。
我希望程序集在与 Windows 身份验证主站点运行的用户不同的用户下运行。
原因是,程序集需要管理员权限 - 但我不希望整个网站/IIS 以管理员身份运行。
这可能吗?
提前致谢,
吉姆
I have an assembly which I call from within my asp.net web site.
I want the assembly to run under a different user than the -windows authenticated - main site runs under.
The reason is, the assembly needs admin permissions - but I don't want the whole website/IIS to be running as an administrator.
Is this possible?
Thanks in advance,
Jim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是,程序集必须在另一个进程中运行才能使用不同的凭据。
以下是如何在 .net 中启动另一个进程的示例
http://www.csharp-station.com/HowTo/ProcessStart.aspx
然后该进程可以在所需的任何权限下运行。
如果是这种情况,您将必须协调您的网站和其他进程之间的交互。
这很可能使用 WCF 来完成
My guess would be that the assembly would have to run in another process in order to use different credentials.
Here's an example of how to kick off another process in .net
http://www.csharp-station.com/HowTo/ProcessStart.aspx
Then that process could run under whatever permission required.
If that's the case you will have to coordinate the interaction between your website and the other process.
This would most likely be done using WCF
是的,你可以做到这一点,你需要使用模拟机制。
您可以使用关键字 asp.net 模拟在 Stack Overflow 和 MSDN 上找到各种资源。
您必须使用不同的帐户运行的程序集将位于何处?
它会加载到您的 Asp.Net 应用程序的现有 AppDomain 中吗?
干杯!
Yes you can do that,you need to use the impersonation mechanism.
You can find tones of resources on Stack Overflow and MSDN using keywords asp.net impersonation.
Where will be located this assembly you'll have to run with a different account?
Will it be loaded within your existing AppDomain of you Asp.Net app?
Cheers!