如何在不同身份下运行iisexpress应用程序池

发布于 2024-10-22 01:54:56 字数 108 浏览 8 评论 0原文

有没有办法以当前登录用户以外的不同身份运行 iisexpress 应用程序池?

我目前正在使用“runas”命令解决这个问题,但我想知道 iisexpress 是否有内置的东西可以利用。

is there a way to run iisexpress app pool under a different identity other than the currently logged in user?

I am getting around this problem using the "runas" command currently but I would like to know if there is something built-in to iisexpress that I can utilize.

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

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

发布评论

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

评论(5

埖埖迣鎅 2024-10-29 01:54:56

看起来这应该是可能的。在 IIS Express 站点的 applicationhost.config 文件中,在 下定义了一个 元素。

元素具有 userNamepassword 属性。

来自 MSDN

指定 ASP.NET 将使用与默认进程标识的 Windows 标识不同的 Windows 标识来运行工作进程。默认情况下,此属性设置为计算机,并且该进程在安装 ASP.NET 时自动创建的名为 ASPNET 的用户帐户下运行。 ASPNET 帐户的密码是在安装时以加密方式生成的。如果此属性和密码属性中提供了有效的凭据,则该过程将使用给定的帐户运行。

这应该允许您使用与登录用户不同的凭据运行该站点。

It looks like this should be possible. In your IIS Express site's applicationhost.config file, there is a <processModel/> element defined in <applicationPoolDefaults> under <applicationPools>

The <processModel> element has attributes for userName and password.

From MSDN:

Specifies that ASP.NET will run the worker process with a Windows identity that is different from the Windows identity for the default process identity. By default, this attribute is set to the Machine, and the process runs under a user account named ASPNET that is created automatically when ASP.NET is installed. The password for the ASPNET account is cryptographically generated at the time of installation. If valid credentials are presented in this attribute and the password attribute, the process is run with the given account.

This should allow you to run the site under different credentials from the logged in user.

青朷 2024-10-29 01:54:56

我无法使上述解决方案发挥作用,并且我希望能够通过 Visual Studio 进行调试,同时在不同的凭据下运行 IIS Express。

  1. 使用“以管理员身份运行”打开命令提示符(您需要提升权限)
  2. 在命令提示符中导航到 Visual Studio 的目录(在我的例子中:“cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\ VS2010 的 IDE)。
  3. runas /netonly /user:[domain]\[userid] devenv.exe
  4. 从 VS 打开您的解决方案并填写您的 TFS 凭据(如果适用)。

现在,您可以在作为凭据运行的 IISExpress 下正常调试(假设这是您配置项目的方式)。如果您需要对数据库连接或类似的东西使用集成安全性,但需要使用不同的凭据,那么这非常有用。

I could not get the above solution to work and I wanted to be able to debug through Visual Studio while running IIS Express under different credentials.

  1. Open the command prompt using "Run as administrator" (you need elevated privileges)
  2. Navigate to the directory of Visual Studio in the command prompt (in my case: "cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE" for VS2010).
  3. runas /netonly /user:[domain]\[userid] devenv.exe
  4. Open your solution from VS and complete your TFS credentials (if applicable).

You can now debug as normal under IISExpress (assuming this is how you have your project configured) under the run as credentials. This is great if you need to use integrated security for database connections or something similar but need to use different credentials.

药祭#氼 2024-10-29 01:54:56

“runas”只是解决方案。 IIS Express 可能不尊重 applicationhost.config 文件中定义的 processModel 设置。

"runas" is only the solution. IIS Express maynot respect processModel settings which are defined in applicationhost.config file.

年少掌心 2024-10-29 01:54:56

从命令行运行 /netonly IISExpress.exe 确实可以工作,并且如果您像我们一样迫切需要答案,则非常可行。 相关帖子

Runas /netonly IISExpress.exe from command line does work and is very viable if you're as desperate for an answer as we were. Related post

苏大泽ㄣ 2024-10-29 01:54:56

我想知道这是否真的有效 - IIS Express 似乎在同一进程中运行所有应用程序池 - 并且该进程是在当前用户的上下文中执行的......?

似乎“运行方式”选项可以工作,但这需要我们从命令行(或构建事件)启动 IIS Express,而不是依赖 Visual Studio 启动它。 :(

I wonder if this really works - IIS Express seems to run all application pools in the same process - and that process is executed in the context of the current user...?

Seems the "Run as" option could work, but that would require us to launch IIS Express from the command line (or build event) instead of relying on Visual Studio starting it up. :(

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