Question Windows service not able to ping IP in Windows Server 2008

nazrul84

New member
Joined
Aug 17, 2011
Messages
2
Programming Experience
3-5
My application is having two parts. One is windows application and other one is windows service. Both the application will poll(download) data from a machine connected via Ethernet TCP/IP connection.I am using windows server 2008. I am facing issue to communicate with the machine from windows service. The same code will communicate to the machine from windows application but if fails if I execute from services. The service is working fine for Windows XP and windows server 2003. My prime suspect is the windows service permission to access Network resources in windows server 2008. I am using the following code and the following code will return the correct IP address but "objWinSocket.Ping()" is returning 0 i.e. not able to ping. The same code will work fine in windows application.

objWinSocket = new CRsiComWinsock();
objWinSocket.SetHost(objRsiHp4KLoc.IpAddress);
objWinNetwork = new CRsiNetwork(objWinSocket);
objRsiHandReader = new CRsiHandReader();
if (trueVal == objWinSocket.Ping())

Help will be highly appreciated. Thanks.
 
It could be permission, have you tried running the service under different account? Or it could be the COM object that refuses to operate as service.

Also, .Net Framework comes with a Ping class, including a simple interface using My.Computer.Network.Ping method.
 
Back
Top