![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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();
}
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();
}
说明:
其中,sub.StartSubscriber() 中是向ICE Storm 的订阅,需要创建委托并向ICE storm server 进行订阅,同时本地会监听一个端听,用于实现回调
症状:
目前所遇到的问题是: 无法执行回调函数
同时发现本机的监听端听已经在侦听了, 而且 sub.StartSubscriber(); 也执行正常,
通过测试 发现如果在windows form 项目里 回调是没问题的
疑问:是否是windows 服务程序 与 远程方法调用或回调相冲突?
本来就没有开发过WINDOWS 服务程序,所以
困扰了近两个星期, 也没找到解决方法
重新创项目还是不行
不得己写小服务程序调试,不行!
突然想换台机器试试,到同事的电脑上跑?可以了,郁闷
回头一看,windows防火墙在开着,立马关上,可以了,晕,郁闷ing!