简体   繁体   English

使用IUSR而不是应用程序池标识的ASP.NET Web服务

[英]ASP.NET web service using IUSR, not Application Pool Identity

This question seems to be similar to this one: IIS site not using identity specified in app pool IIS 7 + However, there are no answers there. 这个问题似乎与此类似: IIS站点未使用在应用程序池IIS 7 +中指定的身份。但是,那里没有答案。

There's a tl;dr at the bottom. 底部有一个tl; dr。

A thing to keep in mind is that I'm not the one who set up the server so they may have changed some settings I don't know about. 请记住,我不是设置服务器的人,因此他们可能已经更改了一些我不知道的设置。

We have an ASP.NET web service running on IIS 7. The web service is set to use DefaultAppPool, and the app pool's Identity is set to a domain user (let's say it's "localdomain\\user1"). 我们有一个在IIS 7上运行的ASP.NET Web服务。该Web服务设置为使用DefaultAppPool,而应用程序池的Identity设置为域用户(假设它是“ localdomain \\ user1”)。

The web service was unable to save to a certain network folder, so we gave localdomain\\user1 read/write permissions to that folder. Web服务无法保存到某个网络文件夹,因此我们授予了localdomain \\ user1对该文件夹的读/写权限。 It still can't save there, however. 但是,它仍然无法保存在那里。

I can't remote debug, and it works fine on my own computer (probably because it's running in Visual Studio's IIS express and my user does have access), so I tried to change the web service so that the error message contains the user name it's running under. 我无法进行远程调试,并且它在我自己的计算机上运行良好(可能是因为它在Visual Studio的IIS Express中运行,并且我的用户确实具有访问权限),因此我尝试更改Web服务,以便错误消息中包含用户名它正在运行。

If I use Environment.UserName to get it, the result is "IUSR". 如果我使用Environment.UserName来获取它,则结果为“ IUSR”。 If I use System.Security.Principal.WindowsIdentity.GetCurrent().Name , it returns "NT AUTHORITY\\IUSR". 如果我使用System.Security.Principal.WindowsIdentity.GetCurrent().Name ,它将返回“ NT AUTHORITY \\ IUSR”。

Unless the above methods are not reliable, the web service seems to be running under the default user (IUSR) and not the one set in its application pool. 除非上述方法不可靠,否则该Web服务似乎在默认用户(IUSR)下运行,而不是在其应用程序池中的一个下运行。 I can't figure out why, can anyone explain? 我不知道为什么,有人可以解释吗?

EDIT: The Task Manager on the server, if I log in using RDP, shows that the w3wp.exe process IS being run by user1. 编辑:服务器上的任务管理器,如果我使用RDP登录,则表明w3wp.exe进程正在由user1运行。 I'm not sure which one to believe. 我不确定该相信哪一个。

Thank you. 谢谢。

tl;dr : The web service's application pool is set to a domain user, but it seems to be running under IUSR anyway. tl; dr :Web服务的应用程序池设置为域用户,但是无论如何它似乎都在IUSR下运行。 How do I prevent that? 我该如何预防?

Impersonation was the issue. 假冒是问题所在。 I didn't know this was a setting in the web service's web.config. 我不知道这是Web服务的web.config中的设置。

Changing <identity impersonate="true"/> to <identity impersonate="false"/> allows it to run as localdomain\\user1. <identity impersonate="true"/>更改为<identity impersonate="false"/> ,使其可以作为localdomain \\ user1运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM