WCF的问题或事件hadling问题 [英] WCF issue or event hadling issue
本文介绍了WCF的问题或事件hadling问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一类称为MyServiceHost.vb:
I have a class called MyServiceHost.vb:
public class MyServiceHost : ServiceHost
{
private Dictionary<int, Service> _activeClients;
public event EventHandler<MessageReceivedEventArgs> MessageReceived;
}
之后以另一种形式我想在我的其他形式,我定义这些行的第二行:
After that in another form I want to have the second line in my other form I defined these lines:
_host = new MyServiceHost(typeof(Service));
_host.MessageReceived += new EventHandler<MessageReceivedEventArgs>(_host_MessageReceived);
_host.Open();
如何把它们写在Vb.net请大家帮忙,以下似乎不工作:
How to write them in Vb.net please help, the followings does not seem to work:
_host = New MyServiceHost(GetType(Service))
_host. += New EventHandler(Of MessageReceivedEventArgs)(AddressOf _host_messageRecieved)
另外请注意,我MyServiceHost.vb类看起来是这样的:
Also note that my MyServiceHost.vb class looks like this:
Dim _activeClients As Dictionary(Of Integer, Service)
Public Event MessageReceived As EventHandler(Of MessageReceivedEventArgs)
什么是错的?
What is wrong?
推荐答案
请尝试使用:
AddHandler _host.MessageReceived, AddressOf _host_messageRecieved
这篇关于WCF的问题或事件hadling问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文