Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Thread.CurrentPrincipal在Azure上具有空详细信息_C#_Asp.net Mvc_Azure_Azure Web App Service_Adfs - Fatal编程技术网

C# Thread.CurrentPrincipal在Azure上具有空详细信息

C# Thread.CurrentPrincipal在Azure上具有空详细信息,c#,asp.net-mvc,azure,azure-web-app-service,adfs,C#,Asp.net Mvc,Azure,Azure Web App Service,Adfs,我们正在尝试使用Thred.CurrentPrincipal获取用户信息。但是,一旦我们将其部署到Azure,CurrentPrincipal就为null var td = new TokenData(); var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal; if (claimsPrincipal != null) { td.IsAuthenticated = claimsPrincipal.Identi

我们正在尝试使用Thred.CurrentPrincipal获取用户信息。但是,一旦我们将其部署到Azure,CurrentPrincipal就为null

var td = new TokenData();

var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;

if (claimsPrincipal != null)
{
    td.IsAuthenticated = claimsPrincipal.Identity.IsAuthenticated;

    td.Name = claimsPrincipal.FindFirst(ClaimTypes.Name).Value;
    td.Email = claimsPrincipal.FindFirst(ClaimTypes.Upn).Value;
    td.Surname = claimsPrincipal.FindFirst(ClaimTypes.Surname).Value;
    td.Role = claimsPrincipal.FindAll("http://schemas.xmlsoap.org/claims/Group")
        .Select(s=>s.Value);
}
我验证了ADFS的设置是否正确。如果有人能告诉我这件事的痛处,那就太好了

编辑:

CurrentPrincipal不为NULL,但详细信息为。因此,我们无法获得用户名、角色和其他详细信息

编辑2:

这就是Azure上正在发生的事情:


您可能需要打开用户配置文件才能让您的委托人工作


要在网站的门户中打开它,请转到配置->应用程序设置并添加应用程序设置=1。您的站点需要处于基本模式或标准模式才能正常工作。

问题在于没有为ADFS记录设置索赔规则


谢谢你的建议,但这并没有解决我的问题。我会更新我的问题的更多细节。实际上,让我再次检查,因为我的网站是在免费模式。我可以确认,缩放网站和添加参数并没有解决问题。