2013-08-20 5 views
-4
private void RDP(string pass) 
{ 
    try 
    { 
     rdp.Server = TBIP.Text; 
     rdp.UserName = TBUserName.Text; 
     IMsTscNonScriptable secured = (IMsTscNonScriptable)rdp.GetOcx(); 
     secured.ClearTextPassword = pass; 
     rdp.Connect(); 
    } 
    catch (Exception ex) 
    { 
     Console.WriteLine(ex); 
    } 
} 

이 표준 요청 완벽하고있다 :RDP 클라이언트 루프

RDP("123"); 

내가 루프를 만들 수있는 방법. 예를 들어 작동하지 않습니다.

foreach (var p in pwd) 
{ 
    RDP(p); 
    Thread.Sleep(30 * 1000); 
    rdp.Disconnect(); 
    rdp.AllowDrop = true; 
} 

'59'줄에 오류가 발생합니다.

rdp.Server = TBIP.Text; 

"예외 출력은"

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in AxInterop.MSTSCLib.dll 
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. 
    at MSTSCLib.IMsRdpClient8.set_Server(String pServer) 
    at AxMSTSCLib.AxMsRdpClient8.set_Server(String value) 
    at RDP.Form1.RDP() in c:\Users\x\Documents\Visual Studio 2012\Projects\RDP\RDP\Form1.cs:line 59 
+1

무엇이 오류입니까? – CristisS

+2

오류 메시지를 공유하는 데주의하거나 추측 게임입니까? "작동하지 않는다"는 것은 오류가 있음을 의미합니다 * 오른쪽 *? ** 어떤 오류 **? – Arran

답변

0

나는 당신의 오류를 반복 할 수 있지만, 나는 광범위하게 RDP로 테스트 할 수 없습니다,하지만 어쩌면 this post는 당신을 도울 수 있습니다.