2

我正在尝试在作为网站托管在 Windows Azure 中的新创建的 Lightswitch HTML 应用程序中实现 Windows 身份验证。在创建 Active Directory 和应用程序并按照门户中引用的博客条目中提供的步骤之后,我设法获取了登录页面并执行了验证。但是,一旦我回到 HTML 网站,每个请求都会收到 500 错误。

为了测试验证,我创建了一个通用处理程序,它只返回用户名:

public void ProcessRequest(HttpContext context)
{
    using (var serverContext = ServerApplicationContext.CreateContext())
    {
        context.Response.ContentType = "text/plain";
        context.Response.Write(serverContext.Application.User.Name);
    }
}

并禁用 customErrors 并设法获取错误详细信息:

[NullReferenceException: Object reference not set to an instance of an object.]
   Microsoft.LightSwitch.Utilities.Server.Internal.ServerRequestSecurityState.GetSecurityGroupsForCurrentUser(IWindowsIdentity identity) +20
   Microsoft.LightSwitch.Utilities.Server.Internal.ServerRequestSecurityState.GetEffectiveRolesForUser(IIdentity identity, IEnumerable`1 currentRoles, Func`3 getRoles) +687
   Microsoft.LightSwitch.Utilities.Server.Internal.ServerRequestSecurityState.GetEffectiveRolesForUser(IIdentity identity, IEnumerable`1 currentRoles) +121
   Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.GetUserData(IPrincipal principal) +305
   Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityDataProvider.CreateUser(IPrincipal principal) +18
   Microsoft.LightSwitch.Security.ServerGenerated.Implementation.SecurityInfo.CreateUser(IPrincipal principal) +7
   Microsoft.LightSwitch.Utilities.Server.Internal.SecurityHelper.ConvertPrincipal(IPrincipal principal) +184
   Microsoft.LightSwitch.Framework.Server.ServerApplication`2.get_User() +166
   LightSwitchApplication.Web.GetUserName.ProcessRequest(HttpContext context) +144
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

我不知道我是否缺少某些东西,或者可能是 Lightswtich 目前不支持这种情况(Azure 网站 + Azure AD 中的 Lightswitch)

4

0 回答 0