C# How to RDP Connect to On Premise Windows Server from Azure App Services?


I have an Asp.net core web api hosted in azure app service. My web api should connect to one or many On Premise windows servers to create DNS records. The windows servers are running the DNS service. I am using System.Management to connect to the on premise windows servers.

However, I am not successful in connecting to the remote server from azure app service. I sure believe i am missing some kind of a configuration but I don't know..

Here is my code:

using System.Management;

public static ManagementScope ConnectDNSServer(string dnsServerName, PCSCredential useMyInfo)
    ConnectionOptions options = new ConnectionOptions
        Username = useMyInfo.WindowsDomain + "\\" + useMyInfo.UserName,
        Password = useMyInfo.PassString

        ManagementScope scope = new ManagementScope(@"\\" + dnsServerName + "\\root\\MicrosoftDNS", options);
        return scope;
        //ManagementScope scopeEx = new ManagementScope();                
    return null;

I get this error:

System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
asked on Stack Overflow Nov 5, 2019 by blogs4t

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0