在WCF应用程序C#语言中引发事件 [英] raise event in wcf application c# language

查看:89
本文介绍了在WCF应用程序C#语言中引发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我有通过gsm调制解调器发送短信的wcf应用程序,我使用dll组件logix移动网站

此dll有一个事件委托"newmessagerecive",在sms接收时引发

我在wcf应用程序中使用了此事件,但是当与wcf通讯的Windows applicaton处于Clode状态时不起作用.

在哪里使用此事件始终有效?
感谢

解决方案

您无法设置一个事件,该事件在应用程序关闭时将起作用-您可以,但是您正在寻找编写设备驱动程序,这是全新的复杂性层.

相反,请看编写Windows服务,该服务监视传入消息并激活您的主应用程序来处理它们.


您可能有一个小型的侦听客户端应用程序,该应用程序在用户每次登录时都运行如果未打开WCF客户端,则WCF服务应与监听的客户端应用通信(可能再次通过WCF),然后此监听器可以启动完整的WCF客户端.确保侦听器没有UI,并且不容易关闭.这样,最终用户将不会意外关闭它.侦听器的唯一目的是在客户端当前未运行时启动客户端.


hi Nishant Sivakumar

我想在WCF应用程序中写入此事件.没有中介Windows应用程序.

此事件是否可以在wcf中很好地工作?
谢谢


hi i have wcf aplication that send sms with gsm modem i use dll component logix mobile site

this dll have a event delegate "newmessagerecive" that raise when sms recive

i use this event in wcf application but dont work when windows applicaton that comunicate with wcf is clode do not work.

where use this event that work always?
thanks

解决方案

You can''t set up an event that will work when the application is closed - you can but then you are looking at writing device drivers, which is a whole new layer of complexity.

Instead, look at writing a windows service, which monitors for incoming messages and activates your main app to handle them.


You could have a small listening client app that runs each time the user logs in. If the WCF client is not open, the WCF service should communicate to the listening client app (perhaps again via WCF) and then this listener can launch the full WCF client. Make sure the listener has no UI and is not easily closed. That way the end-user will not accidentally close it. The listener''s only purpose would be to launch the client when the client is not currently running.


hi Nishant Sivakumar

i want this event write in wcf application. with out intermediary windows application.

is it possible this event work good in wcf?
thanks


这篇关于在WCF应用程序C#语言中引发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆