Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일

RDP ActiveX 컨트롤로 특정 PC에 연결할 수 없을 때, 오류 상황을 해결하기 위한 팁

다음과 같은 질문이 있군요.

ActiveX Control을 이용해서 원격 접속 프로그램을 만드려고 하는데... 
; https://social.msdn.microsoft.com/Forums/ko-KR/762f47c8-bba9-47cb-b7af-12122395f09f/activex-control-?forum=visualcsharpko

다음의 글을 이용해,

Remote Desktop using C#.NET
; http://www.codeproject.com/Articles/43705/Remote-Desktop-using-C-NET

C# Windows Forms 프로젝트를 만들어 "Microsoft Terminal Services Control Type Library 1.0"을 참조 추가하고, 비주얼 스튜디오의 도구 상자(Toolbox) 윈도우에서 마우스 우클릭해 COM 컨트롤을 추가했습니다. COM 컨트롤 추가 시의 ActiveX 컨트롤 이름은 "Microsoft RDP Client Control - version [번호]"로 나옵니다. (현재는 version 10이 가장 최신인 듯 합니다.)

그런 다음 간단하게 코드 작성하고 Connect 메서드를 호출했는데,

rdp.Server = "...[Windows 10 PC의 IP 주소]...";
rdp.Connect();

반응이 없습니다. 이럴 때 어떤 오류가 발생했는지 알아내고 싶다면 OnDisconnected 이벤트를 구독하면 됩니다.

private void button1_Click(object sender, EventArgs e)
{
    rdp.Server = "...[Windows 10 PC의 IP 주소]...";
    rdp.OnDisconnected += Rdp_OnDisconnected;
    rdp.Connect();
}

private void Rdp_OnDisconnected(object sender, AxMSTSCLib.IMsTscAxEvents_OnDisconnectedEvent e)
{
    string txt = rdp.GetErrorDescription((uint)e.discReason, (uint)rdp.ExtendedDisconnectReason);
    System.Diagnostics.Trace.WriteLine(txt);
}

보는 바와 같이 GetErrorDescription을 호출해 주면 자세한 오류 메시지를 확인할 수 있는데, 이번 경우에는 다음과 같았습니다.

e.discReason == 2825

GetErrorDescription 반환: The remote computer requires Network Level Authentication, which your computer does not support. For assistance, contact your system administrator or technical support.


이 정도면 검색으로 충분히 오류 해결을 할 수 있습니다. ^^

TS Server with NLA enabled: mstsc.exe works, application with RDP ActiveX fails to connect
; https://social.technet.microsoft.com/Forums/windowsserver/en-US/49147937-1921-4ac2-a60d-223628392396/ts-server-with-nla-enabled-mstscexe-works-application-with-rdp-activex-fails-to-connect?forum=winserverTS

위의 글에 해결방법이 나오는데 다음과 같은 라인을 추가해 NLA(Network Level Authentication) 설정이 되어 있는 윈도우 운영체제에 연결할 수 있습니다.

private void button1_Click(object sender, EventArgs e)
{
    rdp.Server = "...[Windows 10 PC의 IP 주소]...";
    rdp.AdvancedSettings7.EnableCredSspSupport = true;
            
    rdp.OnDisconnected += Rdp_OnDisconnected;
    rdp.Connect();
}

(첨부 파일은 이 글의 예제 코드를 포함합니다.)




오류 코드 하나 더 추가.

e.discReason == 1033

GetErrorDescription 반환: The connection cannot proceed because authentication is not enabled and the remote computer requires that authentication be enabled to connect.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 8/1/2016]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 121  122  [123]  124  125  126  127  128  129  130  131  132  133  134  135  ...
NoWriterDateCnt.TitleFile(s)
10845정성태9/3/201521884오류 유형: 305. 윈도우 백업 시 오류 - 0x80780166
10844정성태9/2/201523084.NET Framework: 528. C# - 상호 참조하는 경우의 정적 생성자 동작 방식 [4]파일 다운로드1
10843정성태9/1/201523773VS.NET IDE: 101. Visual Studio 2015의 솔루션 탐색기가 클래스 뷰 정보로 인해 느려지는 현상
10842정성태9/1/201520856.NET Framework: 527. 닷넷 사용자 정의 예외 클래스의 최소 구현 코드 - 세 번째 이야기
10841정성태8/31/201530160개발 환경 구성: 276. Visual Studio 2013에서 C# 6과 닷넷 4.6 기능을 사용하려면?
10839정성태8/22/201528723Windows: 112. 윈도우 10에서 터치 키보드를 안 뜨게 할 수 있는 방법 [4]
10838정성태8/22/201539006오류 유형: 304. Windows 10에서 VPN 연결이 실패한다면? [3]
10837정성태8/21/201519307오류 유형: 303. Your computer is low on memory. Save your files and close these programs...
10836정성태8/21/201520221오류 유형: 302. 설치 파일 실행 시 "This app can't run on your PC" 오류가 뜬다면?
10835정성태8/21/201528770웹: 31. Microsoft Edge 브라우저를 명령행에서 띄우는 방법 [1]
10834정성태8/19/201520863.NET Framework: 526. 닷넷 - 값 형식을 new 없이 생성하면 0으로 초기화되지 않는다?
10833정성태8/18/201525440.NET Framework: 525. C# - 닷넷에서 프로세스가 열고 있는 파일 목록을 구하는 방법파일 다운로드1
10832정성태8/17/201529886디버깅 기술: 74. x64 콜 스택 인자 추적과 windbg의 Child-SP, RetAddr, Args to Child 값 확인 [8]파일 다운로드2
10831정성태8/13/201529876.NET Framework: 524. .NET 4.0과 .NET 4.5의 컴파일 결과 차이점 [1]파일 다운로드1
10830정성태8/12/201523858개발 환경 구성: 275. Web.config이 적용되지 않는 프로젝트에서 Razor 템플릿 파일의 C# 컴파일러 버전 제어 [1]
10829정성태8/10/201525954개발 환경 구성: 274. PowerShell/명령행에서 JDK/JRE를 무인(unattended)/자동 설치를 하는 방법 [3]
10828정성태8/10/201531544웹: 30. Edge 브라우저에서 "이 웹 사이트에는 Internet Explorer가 필요함" 단계를 없애는 방법 [1]
10827정성태7/8/201532951개발 환경 구성: 273. Visual Studio 2015에서 Github와 연동하는 방법 [3]
10826정성태7/8/201522555오류 유형: 301. The trust relationship between this workstation and the primary domain failed. - 두 번째 이야기
10825정성태7/8/201522132개발 환경 구성: 272. Visual Studio IDE 설치 없이 Visual Studio SDK 설치하는 방법
10824정성태7/7/201527300개발 환경 구성: 271. Team Foundation Server 2015 설치 방법 [1]
10823정성태7/7/201527890오류 유형: 300. SqlException (0x80131904): Unable to open the physical file
10822정성태7/7/201527243오류 유형: 299. The 'Visual C++ Project System Package' package did not load correctly.
10821정성태7/7/201519498오류 유형: 298. Unable to start debugging on the web server. IIS does not list a web site that matches the launched URL.
10820정성태7/7/201525392오류 유형: 297. HTTP Error 503. The service is unavailable. - 두 번째
10819정성태7/2/201528881오류 유형: 296. SQL Server Express 시작 오류 - error code 3417
... 121  122  [123]  124  125  126  127  128  129  130  131  132  133  134  135  ...