反向WCF-从服务器在客户端计算机上调用服务 [英] Reverse WCF - calling a service on a client machine from a server

查看:258
本文介绍了反向WCF-从服务器在客户端计算机上调用服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个不寻常的要求.我有一个具有特定用途的网站,关键的事情之一是能够在客户端计算机上打印到连接到该计算机的打印机.这是一个标签打印机,需要特定的编码,因此我可以通过浏览器进行打印.

我正在研究的一种解决方案是使用WCF.这个想法是,当用户单击打印"时,网页将调用客户端上运行的WCF服务,并将打印作业的详细信息发送给它.然后该服务可以将数据发送到打印机.

客户端计算机在网络上并且正在浏览Internet,Web服务器不在该网络上.那么,服务器如何找到客户端上运行的WCF服务?

我想到的微小变化是在Web服务器上提供了一项服务,客户端定期轮询该服务以查看是否有适合他们的新打印作业.不那么整洁,我仍然需要确保每个客户端都只为他们选择打印作业.区分客户容易吗?

我对WCF还是很陌生,所以我希望自己缺少明显的东西.

谢谢.

Hi,

I have a bit of an unusual requirement. I have a website that has a specific use and one of the key things is to be able to print on the client machine to a printer connected to that machine. It''s a label printer and requires specific coding, so I can print through the browser.

One solution I''m investigating is using WCF. The idea is that when the user clicks print the web page would then call WCF service running on the client and send the specifics of the print job to it. The service could then send the data to the printer.

The client machine is on a network and is browsing the internet, the web server is not on that network. So, how does the server find the WCF service running on the client?

The slight variation I thought of was to have a service on the web server and the clients regularly poll that service to see if there''s a new print job for them. Not as neat, and I still need to make sure that each client only picks up the print jobs for them. Is it easy to distinguish the clients?

I''m quite new to WCF so I''m hoping I''m just missing something obvious.

Thanks.

推荐答案

用户单击打印页面"时,他正在打印机所连接的客户端计算机上执行此操作,我是否正确理解了这一点? ?
这样就不必再次涉及服务器.事情必须在客户端上处理.
我会在客户端上安装一个小程序来完成实际的打印工作.通过单击该链接可以调用它-为此,您必须发明"您自己的URL类型并将其注册在注册表中.看一下HKEY_CLASSES_ROOT \ http的操作方法,然后链接看起来像< a href ="printme:///C:/temp/myfile.dat">打印页面</a>
When the user clicks "print page", he''s doing that on the client machine where the printer is connected to, did I understand that correctly?
Then it is not necessary to involve the server again. Things have to be handled on the client.
I''d install a small program on the client which does the actual printing job. It is called by click on that link - for that purpose you must "invent" your own URL type and register it in the registry. Take a look at HKEY_CLASSES_ROOT\http how to do it, the link could then look like <a href="printme:///C:/temp/myfile.dat">print page</a>


这篇关于反向WCF-从服务器在客户端计算机上调用服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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