C# WinForms PING Works in debugger with command line parameters but not when manually launched -


if launch app without command line parameters, supply computer connect to, works ok.

if configure debug mode command line parameter, , launch application, works ok.

if launch application command line parameters outside of visual studio, there issues...

if not ping machine make sure there (passed on command line) commenting out code it, there no issues...

if leave code ping machine, have issues when running command line parameters...

i same issues if search ad machine...

the errors getting ping appears dns issue returns host not found.

the errors getting ad check network path not found.

i have launched "messagebox.show("\""+host\"\"");" before doing check , parameter being passed correct.

any ideas?

i'm running visual studio 2015 , compiling using anycpu , .net 4.6.1

here pingcomputer , computerexistsinad code:

    public static bool pingcomputer(string systemname, int timeout = 5000)     {         try { return (new ping()).send(systemname, timeout).status == ipstatus.success; } catch { }         return false;     }      public static bool computerexistsinad(string systemname)     {         try         {             principalcontext context = new principalcontext(contexttype.domain, environment.userdomainname);             computerprincipal principal = new computerprincipal(context);             principal.name = systemname;             principalsearcher searcher = new principalsearcher();             searcher.queryfilter = principal;             return searcher.findone() != null;         }         catch { }         return false;     } 

seems issue .net 4.6.1... went 4.5.2, , works without other changes...


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -