Windows Authentification (PopulateWindowsIdentity issue )

Windows Authentification (PopulateWindowsIdentity issue )

Old forum URL:

cconte posted on Monday, June 24, 2013

Context : NET 4.5 / SL 5 / Csla: / IIS: 7.5 / OS: Win7

Hi everyone,

I am currently experiencing a problem getting windows authentication working with my CSLA 4.5 SL application.  I have setup windows authentication the same way as the samples from the ebook (04-Dataportal).

When I run the application from my development workstation with IISExpress, everything works fine.  So I have next setup my development and test web servers using IIS 7.5.  I have worked through many issues getting impersonation to work (starting with just enable Windows Authentification and ASP.NET Identity, using v4.0 Classic application pool ...).  Now, I think the IIS configuration and web.config are fine (Just in case, I have included them at the end of the post).  

Now, when I call the application (hosted into iis) from the browser on my development machine, the browser authentication prompt is displayed but if I log-in I get the following exception : "Some or all identity references could not be translated":

So, I ended up setting up remote debugging on my development web server to see what was going on.I have found that the exception came up on the PopulateWindowsIdentity method (Csla.Silverlight.Security)

Below, the stack trace:

    à System.Security.Principal.SecurityIdentifier.Translate(IdentityReferenceCollection sourceSids, Type targetType, Boolean forceSuccess)

   à System.Security.Principal.SecurityIdentifier.Translate(Type targetType)

   à Csla.Silverlight.Security.WindowsIdentity.PopulateWindowsIdentity()

   à Library.CustomIdentity.DataPortal_Fetch() dans c:\Users\CONTE\Documents\Visual Studio 2012\Projects\Samples\CSLA V4.5.30-23\04-DataPortal-110504\Authentication\Windows 4.5\Library.Net\CustomIdentity.cs:ligne 27

   à lambda_method(Closure , Object , Object[] )

   à Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Boolean hasParameters, Object[] parameters)


Does anybody know what the issue here might be?  


Here some posts with interesting advices:


IIS Configuration used :
·         IIS Authentication settings: ASP.NET Impersonation and Windows Authentication are enabling.
·         ASP.NET v4.0 Classic is used for the application pool

web.config used:
    <add key="CslaAuthentication" value="Windows"/>
    <add key="CslaWriter" value="Csla.Serialization.Mobile.CslaBinaryWriter, Csla" />
    <add key="CslaReader" value="Csla.Serialization.Mobile.CslaBinaryReader, Csla" />
    <compilation debug="true" targetFramework="4.5"/>
    <authentication mode="Windows"/>
    <identity impersonate="true" /> <!-- comment it to run with iis express -->
    <pages controlRenderingCompatibilityVersion="4.0"/>
      <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
          <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\temp\WinAuthTrace.xml"/>
    <trace autoflush="true"/>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
      <service name="Csla.Server.Hosts.WcfPortal" behaviorConfiguration="windowsAuthReturnFaults">
        <endpoint binding="wsHttpBinding" bindingConfiguration="wsHttpBinding_IWcfPortal" contract="Csla.Server.Hosts.IWcfPortal"/>
      <service name="Csla.Server.Hosts.Mobile.WcfPortal" behaviorConfiguration="returnFaults">
        <endpoint binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_IWcfPortal"
                  contract="Csla.Server.Hosts.Mobile.IWcfPortal" />
          <binding name="basicHttpBinding_IWcfPortal"
            <readerQuotas maxBytesPerRead="2147483647"
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows"/>
        <binding name="wsHttpBinding_IWcfPortal" 
          <readerQuotas maxBytesPerRead="2147483647" 
        <behavior name="returnFaults">
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceAuthorization impersonateCallerForAllOperations="true" /> <!-- comment it to run with iis express -->
        <behavior name="windowsAuthReturnFaults">
          <serviceDebug includeExceptionDetailInFaults="true"/>
           <serviceAuthorization impersonateCallerForAllOperations="true"/>


Best regards,




cconte replied on Monday, July 01, 2013

Hi everyone,

I'm scratching my head and i'm running out of options about the PopulateWindowsIdentity issue. I dont know if my problem came from IIS setting issue or something with the csla. Is someone has set windows authentification with  NET 4.5 / SL 5 to give some feedback ?

I think to use a woraround byimplementing  impersonation on the server  based on their username/password.

Thx for your help in advance.


RockfordLhotka replied on Monday, July 01, 2013

Is it possible that the IIS server is running your code in partial trust? Maybe that blocks the API call to AD to get the user's info?

cconte replied on Tuesday, July 02, 2013

Thank you Rocky for your help.

I have checked it and the IIS trust level is set to Full.

I'm keep going  investigating...


cconte replied on Monday, August 19, 2013

Hi everyone,

Just wanna share with you what i have found about the windows authentification for the Silverlight Application. Actually, to make it run, I have switched the IIS Application Pool Identity  from “ApplicationPoolIdentity” to “NetWorkService” and next restart IIS. All the settings (web.config and IIS) from my previous post was right, the only little thing missing  was the IIS Application Pool Identity. 

Hope it helps someone else.

SPeters replied on Tuesday, March 18, 2014

I am having this exact same problem.  "Some or all identity references could not be translated." occuring when calling PopulateWindowsIdentity().

However, if I switch my AppPool to NetworkService, the error goes away but then the AppPrincipal is retrieving the user 'NETWORK SERVICE'.  This is a problem as I need to be able to check the AppPrincipal.Username and assign appication level security based on that information.  I suspect I need to use ApplicationPoolIdentity.

Running locally works perfectly but I can't seem to find the IIS setting to make this work on the webserver.  Using .NET 4.5 and CSLA 4.5.40.

ajj3085 replied on Wednesday, April 16, 2014

Are you setting identityImpersonate in your web.config?

Copyright (c) Marimer LLC