You can't create multiple System.Management.Automation runspaces in a web app for two or more different users

When you try to allow multiple users to create System.Management.Automation runspaces in a web application and you're using implicit credentials (for example, credentials from impersonation), you notice that only the first user who accesses the web application can call the CreateRunspace method. All subsequent requests fail with an exception that resembles the following:

at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager.Initialize
at System.Management.Automation.Remoting.Client.WSManClientSessionTransportManager..ctor
at System.Management.Automation.Remoting.ClientRemoteSessionDSHandlerImpl..ctor
at System.Management.Automation.Remoting.ClientRemoteSessionImpl..ctor
at System.Management.Automation.Internal.ClientRunspacePoolDataStructureHandler..ctor
at System.Management.Automation.Runspaces.Internal.RemoteRunspacePoolInternal.CreateDSHandler
at System.Management.Automation.Runspaces.RunspacePool..ctor
at System.Management.Automation.RemoteRunspace..ctor
at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace
at System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace
This behavior is by design.
To create multiple System.Management.Automation runspaces in a web application for two or more different users, you must pass in explicit credentials.
More information
In order to create multiple remote management runspaces, make sure that the following conditions are true: 
  • ASP.Net impersonation is not enabled on the IIS virtual directory.
  • All Windows impersonation logic has been removed from your code.
  • Your users are prompted for a user name and password.

Article ID: 3115600 - Last Review: 11/11/2015 22:22:00 - Revision: 2.0

Windows Server 2012 R2 Essentials, Windows Server 2012 R2 Standard, Windows Server 2012 Essentials, Windows Server 2012 Standard, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 Standard, Windows Server 2008 Enterprise, Exchange Server 2016 Enterprise Edition, Microsoft Exchange Server 2013 Enterprise, Microsoft Exchange Server 2010 Enterprise

  • kbsurveynew KB3115600