wcf双工通信的问题 100
我现在做了个wcf实时通知的程序,用的wcf双工,现在遇到的问题是客户端(winform)第一次打开没有任何问题,都很正常。然后我将客户端关了,在打开wcf就不通知了。弄...
我现在做了个wcf实时通知的程序,用的wcf双工,现在遇到的问题是客户端(winform)第一次打开没有任何问题,都很正常。然后我将客户端关了,在打开wcf就不通知了。弄了半天没闹明白怎么回事,求大神指点。
public ListForm(adminlist admin)
{
InitializeComponent();
this.admin = admin;
DuplexCallbackHandler handler = new DuplexCallbackHandler();
handler.adm = admin;
handler.lForm = this;
InstanceContext instanceContext = new InstanceContext(handler);
CallBackService.CallBackServiceClient client = new CallBackService.CallBackServiceClient(instanceContext);
client.HasNewMeesage();
}
客户端调用代码。
#region 回调类
public class DuplexCallbackHandler : CallBackService.ICallBackServiceCallback
{
public adminlist adm; public ListForm lForm = null;
public void DuplexCallbackFunction(bool result,int a_id,string productname,int pid,string tel)
{
if (result)
{
if (adm.a_id == a_id)
{
Detail frmShowWarning = new Detail(tel, productname, pid.ToString(), lForm);
lForm.Bind();
}
}
}
}
#endregion
回调处理类 展开
public ListForm(adminlist admin)
{
InitializeComponent();
this.admin = admin;
DuplexCallbackHandler handler = new DuplexCallbackHandler();
handler.adm = admin;
handler.lForm = this;
InstanceContext instanceContext = new InstanceContext(handler);
CallBackService.CallBackServiceClient client = new CallBackService.CallBackServiceClient(instanceContext);
client.HasNewMeesage();
}
客户端调用代码。
#region 回调类
public class DuplexCallbackHandler : CallBackService.ICallBackServiceCallback
{
public adminlist adm; public ListForm lForm = null;
public void DuplexCallbackFunction(bool result,int a_id,string productname,int pid,string tel)
{
if (result)
{
if (adm.a_id == a_id)
{
Detail frmShowWarning = new Detail(tel, productname, pid.ToString(), lForm);
lForm.Bind();
}
}
}
}
#endregion
回调处理类 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询