Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

"WSMan Initialization failed with error code: -2144108171" error with RunspaceFactory.CreateRunspace(connectionInfo), help pleaseRSS

$
0
0

I have a asp.net MVC web app controller to connect exchange server powershell with the following codes:

…...

connectionInfo =newWSManConnectionInfo(newUri(ConfigurationManager.AppSettings.Get("WSManConnectionInfo").ToString()),"http://schemas.microsoft.com/powershell/Microsoft.Exchange", newCred);
            connectionInfo
.AuthenticationMechanism=AuthenticationMechanism.Kerberos;

 string rspace ="space is OK";
           
try
           
{
               
//--create remote sunspace
                runspace
=RunspaceFactory.CreateRunspace(connectionInfo);
           
}catch(Exception ex2)
           
{
                rspace
= ex2.Message.ToString();
           
}
           
ViewBag.rspace= rspace;//show the above error message on client side view

The above codes works fine from my local machine, but I got the above error after publishing to production server, please note I can see the "Microsoft.Management.Infrustructure.dll" is existed on the bin folder of production server.

Please advise if how to fix this error, much appreciated,

Edit: I even tried to add these 3 lines codes, but same error;

connectionInfo.SkipCACheck =true;

connectionInfo.SkipCNCheck =true;

connectionInfo.MaximumConnectionRedirectionCount = 4;

Edit: the System.Management.Automation.dll is also added in the Reference folder

Edit: I also tried to add the code of "connectionInfo.ProxyAuthentication = AuthenticationMechanism.Negotiate; ", but this does not work as well


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>