Code Private Thread workerThread = null;
Private Subscriber sub;
Public DataReceiveService ()
{
InitializeComponent ();
CanShutdown = true;
CanStop = true;
Sub = new Subscriber ();
}
Protected override void OnStart (string [] args)
{
EventLog. WriteEntry ("Start Server:" + DateTime. Now. ToString ());
WorkerThread = new Thread (new ThreadStart (ServiceWorkerMethod ));
WorkerThread. Start ();
}
Protected override void OnStop ()
{
ReciveDataStatus. StopReviceDate = true;
}
Public void ServiceWorkerMethod ()
{
Sub. StartSubscriber ();
}
Note:
Sub. StartSubscriber () subscribes to ICE Storm. You need to create a delegate and subscribe to ICE storm server,
At the same time, a local listener is used to implement callback.
Symptoms:
Currently, the following problems occur: the callback function cannot be executed.
At the same time, it is found that the listening end of the local machine is listening, and sub. StartSubscriber (); also runs normally,
The test shows that the callback is normal in the windows form project.
Q: Is the windows Service Program in conflict with remote method calls or callbacks?
No WINDOWS service programs have been developed, so
It has been plagued for nearly two weeks, and no solution has been found.
Re-Project Creation still does not work
You cannot write a small service program for debugging. No!
Suddenly I want to try another machine and run it on my colleague's computer? Yes, it's depressing.
Look back, windows Firewall is on, close immediately, OK, dizzy, depressed ing!