none
Connecting to exchange remote server WinRM cannot process the request RRS feed

  • Question

  • Hi,

    i am using exchange 2013 and try to create email box using C#. referring following blog:

    https://blogs.msdn.microsoft.com/emeamsgdev/2011/08/31/enable-mailbox-against-exchange-2010-from-a-web-application/

    ia m getting following error:

    System.Management.Automation.Remoting.PSRemotingTransportException: Connecting to remote server myexchange.mydomain.com failed with the following error message : WinRM cannot process the request. The following error with errorcode 0x80090311 occurred while using Kerberos authentication: There are currently no logon servers available to service the logon request. Possible causes are: -The user name or password specified are invalid. -Kerberos is used when no authentication method and no user name are specified. -Kerberos accepts domain user names

    following code is use:

       string ConnectionUri = "http://myexchange.mydomain.com/Powershell?serializationLevel=Full";
           
               string sPassword = "password";
                SecureString sSPassword = new SecureString();

                foreach (char X in sPassword)
                    sSPassword.AppendChar(X);

                PSCredential Credential = new PSCredential("administrator", sSPassword);

                // Set the connection info
                WSManConnectionInfo ConInfo = new WSManConnectionInfo((new Uri(ConnectionUri)), "http://schemas.microsoft.com/powershell/Microsoft.Exchange", Credential);
                ConInfo.AuthenticationMechanism = AuthenticationMechanism.Default;
                return ConInfo;

    pls guide what could be an issue. I have configure WinRM on client using

    https://pedroliska.wordpress.com/2011/07/28/creating-an-exchange-2010-mailbox-from-a-remote-c-program/

    thx


    iffi

    • Moved by Victoria Xia Friday, September 23, 2016 3:26 AM Exchange related
    Thursday, September 22, 2016 1:04 PM

All replies

  • Hi,

    Thanks for posting in SharePoint 2013 - Development and Programming.

    This forum is for developers discussing developing issues involve SharePoint product. Since the issue is more relative to exchange development, I would move it to Exchange Server: Exchange Server Development.

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. 

    Thanks for your understanding.

    Best Regards,

    Lee


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, September 23, 2016 4:22 AM
  • The first thing I would suggest you do is try to connect to the Exchange server you want to connect to just from Remote powershell https://technet.microsoft.com/en-us/library/dd335083(v=exchg.160).aspx on the host your trying to run the code from. This will make sure you have all the correct versions installed, credential format and there are no other underlying issue that are causing your code to fail.

    I would also suggest you either use the UPN as the user or downlevel format (eg domain\username) when you specify the username which is what the errors is pointing you to.

    Cheers
    Glen  

    Monday, September 26, 2016 2:20 AM
  • Hi,

    from remote machine powershell i am able to connect to exchange and run commands. but i am facing problem while connecting through C# code from same machine.

    how can i add impersonate code.

    any idea why i am not able to connect through code.

    Thanks


    iffi

    Thursday, September 29, 2016 7:39 AM