locked
I cannot open a runspace with asp mvc RRS feed

  • Question

  • Hello,

    I try to debug this code to run commands on a remote Exchange server (host in a virtual machine) from my client

    Uri uriPs = new Uri("http://" + server + "/powershell");
                    string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.Exchange";
                    SecureString secure = new SecureString();
                    foreach (char c in password)
                    {
                        secure.AppendChar(c);
                    }
                    PSCredential credential = new PSCredential(username, secure);
                    WSManConnectionInfo connPs = new WSManConnectionInfo(uriPs, shellUri, credential);                
                    connPs.AuthenticationMechanism = AuthenticationMechanism.Kerberos;
    
                    Runspace runspace = RunspaceFactory.CreateRunspace(connPs);
                    runspace.Open();
                    PowerShell powershell = PowerShell.Create();
                    powershell.Runspace = runspace;

    When i run this code in a Console Application... it works! Yeaha...

    But, when i run it in a Asp Mvc application, i have an error:

    Processing data for a remote command failed with the following error message: <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="3762507597" Machine="server"><f:Message><f:ProviderFault provider="PowerShellplugin" path="%windir%\system32\pwrshplugin.dll"></f:ProviderFault></f:Message></f:WSManFault> For more information, see the about_Remote_Troubleshooting Help topic

    I am almost desperate to find a solution. Any help of any kind will be welcome.

    Thank you in advance.

    • Moved by Caillen Monday, January 27, 2014 2:34 AM
    Friday, January 24, 2014 3:55 PM

Answers

  • Hi Sébastien,

    Please post your question in this forum where you could get better responses.

    ASP.NET Forums >> General ASP.NET >> MVC

    Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Monday, January 27, 2014 4:38 PM
    • Marked as answer by Just Karl Thursday, February 6, 2014 6:09 PM
    Monday, January 27, 2014 2:34 AM

All replies

  • Hi Sébastien,

    Please post your question in this forum where you could get better responses.

    ASP.NET Forums >> General ASP.NET >> MVC

    Thanks for your understanding.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Just Karl Monday, January 27, 2014 4:38 PM
    • Marked as answer by Just Karl Thursday, February 6, 2014 6:09 PM
    Monday, January 27, 2014 2:34 AM
  • Thanks for the info. Post moved.
    Monday, January 27, 2014 8:15 AM