IIS7.5 Application Pool, process identity and environment

前端 未结 1 787
执笔经年
执笔经年 2021-01-24 21:45

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

1条回答
  •  隐瞒了意图╮
    2021-01-24 22:02

    If already not having it, try setting:

    
    

    in web.config

    EDIT

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

    System.Security.Principal.WindowsIdentity.GetCurrent()
    

    EDIT 2

    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:

        
    

    You can also set this through inetmgr: ASP.NET Impersonation Settings screenshot

    Either way, after setting this,

    Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
    

    gives:

    C:\Users\obrad\AppData\Local
    

    Another update:

    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

        
    

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

    app settings screenshot

    0 讨论(0)
提交回复
热议问题