获取当前登录的用户IIS,返回DefaultAppPool [英] Get current logged in user IIS returning DefaultAppPool

查看:149
本文介绍了获取当前登录的用户IIS,返回DefaultAppPool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的服务器上有一个使用WindowsAuthentication登录的asp.net应用程序。情况很简单:用户登录后,将使用相同的凭据登录该应用程序。

I have an asp.net application on my server that uses WindowsAuthentication to log in. The scenario is simple: users logged in, will use the same credentials to login the application.

当然,在我的机器上的IISExpress上运行良好,但是当我尝试在服务器上登录应用程序时,返回的当前用户是 DefaultAppPool

Certainly, on IISExpress on my machine works great, but when I try to login the application on server, the current user returned is DefaultAppPool.

我想这是IIS上缺少的模拟配置。我试图通过以下方式获取当前用户:

I guess it's a missing impersonate config on IIS. I tried to get the current user with:

string username = HttpContext.Current.Request.LogonUserIdentity.Name;
string username = WindowsIdentity.GetCurrent().Name;

...以上所有内容均返回当前登录用户,但仅适用于IISExpress,但不适用于服务器IIS。

... and all of above returns the current user loggedin but only works on IISExpress, but not on server IIS.

IIS Express配置

DefaultAppPool

-Framework 4.0版本

-应用程序池标识

IIS Express config
DefaultAppPool
- Framework Version 4.0
- Application Pool Identity

应用程序身份验证配置

Application Authentication Config

服务器信息

Windows 2008 R2 Enterprise


IIS 7.5

Server Info
Windows 2008 R2 Enterprise
IIS 7.5

PD:不是我最好的英语

PD: Is not my best English

推荐答案

我遇到了类似的问题;据我所知,这是因为web.config文件需要具有以下条目:

I had a similar issues; as far as I can tell it is because the web.config file needs to have the following entries:

<authentication mode="Windows" />
    <identity impersonate="true" />

还要在Internet Information Services(IIS)管理器的 IIS /身份验证部分中,确保仅匿名身份验证并且Windows身份验证已启用。我错误地检查了ASP.NET模拟,这给了我与您在这篇文章中描述的相同的错误。一旦我禁用了它(以及其他修改),它似乎就可以正常工作。

Also in your IIS/Authentication section in Internet Information Services (IIS) Manager, make sure only Anonymous Authentication and Windows Authentication is Enabled. I had ASP.NET Impersonation checked by mistake and it was giving me the same error you described in this post. Once I disabled that (along with the other modifications), it seems to be working fine.

这篇关于获取当前登录的用户IIS,返回DefaultAppPool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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