Dart Home | PowerTCP SSL for ActiveX | Custom Development | Reply | PowerTCP SSL for ActiveX Topics | Forums |
Author | Forum: PowerTCP SSL for ActiveX Topic: Service on W2K |
Rupert Taylor From: Brighton, United Kingdom Posts: 5 Member Since: 05/28/03 |
posted May 28, 2003 3:38 PM Hi I have developed a windows service in VB.Net using the ServiceProcess namespace and not the Dart Service Control. The service uses the Daemon control to wait for a connection on Port 990 and when it receives one it uses the AcceptConnection event to create a secureTCP object to handle the data exchange. When the service is run as an executable it works perfectly well. The clients can connect and send data to the server. When the service is run as a service nothing happens. Once the service has started, if I run NetStat, it states that the PC is listening on port 990 as expected. When the client tries to connect it appears to connect and sends the first packet of data but the service never receives them. The AcceptCoonection event never fires and no error is reported. I have seen other posts in this forum where similar problems have been noted and the answer seems to lie in W2k permissions but which permissions. The service is running as LocalSystem which is a powerful account with access to all server resources. I am also having to run with no secure protocol because I get an "Invalid Certificate' error when I try set the property while running as a service. I have seen posts on this issue as well where the issue of permissions has been raised but no one has said what permissions need to be set. The MCSE's at my client have no idea what the permissions might be. To summarize my questions: 1) What permission(s) need to be set so that a service running on W2k server can receive network connections picked up by the Dart Daemon control. 2) What permission(s) nned to be set so that a service running on W2K server can access a certificate in the certificate store for server authentication. I would gratefully recieve any help on this issue from someone at Dart or anyone else who may have experienced these issues. Thanks in advance. regards Rupert To summarize my questions: 1) |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted May 29, 2003 9:48 AM Hi, I do not know the answer to the question concerning access to certificates. However, I have been able to run a .Net service under the LocalSystem account, and have the Interop Daemon control's Accept event fire. I do not think you are experiencing a permissions problem here, but just the fact that the events never fire. To work around this, I created a new thread that calls DoEvents in a loop. I have included my simple service code below as an example. Aside from this problem, please also be aware that there are licensing issues when using the ActiveX controls in services. Specifically, you will have to have your license in the registry of the machine running the service, just as you would if using the control in a scripting environment. See "Distribution Under IIS" on the Distribution page of the help file for more info on this. -ken |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted May 29, 2003 9:52 AM //Simple Service Code where Accept Event fires DartSock.DaemonClass server; bool stop; public delegate void IdleDelegate(); protected override void OnStart(string[] args) { stop = false; server = new DartSock.DaemonClass(); server._IDaemonEvents_Event_Accept += new DartSock._IDaemonEvents_AcceptEventHandler(server_Accept); server.Listen(7, "", 0); IdleDelegate i = new IdleDelegate(Idle); i.BeginInvoke(new AsyncCallback(DoNothingCallBack),new object[0]); //looping DoEvents on separate thread } private void server_Accept() { DartSock.TcpClass child = new DartSock.TcpClass(); child.Socket = server.Accept(); object data = "Accept event fired."; child.Send(ref data, 0, false); } protected void Idle() { while (stop == false) { System.Windows.Forms.Application.DoEvents(); } } private void DoNothingCallBack(IAsyncResult ar){} protected override void OnStop() { stop = true; } |
Rupert Taylor From: Brighton, United Kingdom Posts: 5 Member Since: 05/28/03 |
posted June 2, 2003 7:00 AM Hi Ken Thanks for the code sample. I converted it to VB.Net and updated my service but I am having the same problem. No event is fired for the AcceptConnection event. I have posted the extract from my service below. Any pointers would be gratefully received. regards Rupert <non-working code> |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted June 3, 2003 10:37 AM Hi, The following VB translation of the code above worked for me. Hope it helps, -ken [Code removed see next post] |
Tony Priest From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted October 14, 2004 10:02 AM The code that was originally posted above used a DoEvents loop that caused .NET messages to stop after running for several hours. Also, the service would use 100% of the CPU at all times. Here is a link to a "HOW TO" that shows a better way to get things working: http://support.dart.com/postings?topicid=4711 |
Reply | PowerTCP SSL for ActiveX Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |