IIS7.5应用程序池,进程标识和环境 [英] IIS7.5 Application Pool, process identity and environment

查看:531
本文介绍了IIS7.5应用程序池,进程标识和环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Web应用程序需要访问本地资源,文件/文件夹,才能够做混帐克隆/拉/推。我创建了一个单独的应用程序池与进程标识==我自己的帐户(机器管理员)。

I have web application that have to access local resources, files/folders, to be able to do git clone/pull/push. I've created a separate Application Pool with Process Identity == my own account (Administrator of machine).

但是,如果我做的:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

返回值:

"C:\\Windows\\system32\\config\\systemprofile\\AppData\\Local"

所以,它看起来像的配置文件是仍在使用。 git的克隆等git的操作挂断了电话,似乎是无法找到的.ssh键等。

so, it looks like system profile is still used. git clone and other git operations hangs up, seems like fail to find .ssh keys etc.

有趣的事情,它工作得很好的Windows SP1更新之前(至少我责怪更新,因为没有更多的改变上机)。

The interesting thing, that it worked fine before Windows SP1 update (at least I blame update, since nothing more changed on machine).

推荐答案

如果已经没有它,尝试设置:

If already not having it, try setting:

<identity impersonate="false"/>

在web.config中

in web.config

修改

我错了,你需要让你的应用程序池的身份与访问本地文件夹的位置:

I was wrong, you need to have your app pool identity with access to local folder here:

System.Security.Principal.WindowsIdentity.GetCurrent()

编辑2

我已经找到解决方案。为你,你需要打开所有的模拟后(应用程序池设置不会对我的IIS7.5应用)中运行的应用程序,但作为一个特定的用户。因此,要实现这一点,你需要把模拟在web.config中,并指定用户:

I have found solution. To run application AS you, you need to turn on impersonation after all (app pool setting does not apply on my IIS7.5), but AS A SPECIFIC USER. So, to enable this, you need to turn impersonation on in web.config AND specify user:

    <identity impersonate="true" password="o1j2813n" userName="obrad" />

您还可以设置这个通过INETMGR:

You can also set this through inetmgr:

无论哪种方式,设置此之后,

Either way, after setting this,

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

给出:

C:\Users\obrad\AppData\Local

另一个更新:

我一直在寻找一种方式,没有把我的密码在web.config中做同样的,并且可以确认,我得到本地用户的文件夹时,也基本是假冒的。

I have been searching for a way to do the same without putting my password in web.config, and can confirm that I get local user folder also when basic impersonation is on

    <identity impersonate="true"/>

但条件是应用程序连接(在应用程序设置 - >连接为...)的我:

But under condition that application connects (under app settings -> Connect as...) as me:

这篇关于IIS7.5应用程序池,进程标识和环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆