简体   繁体   English

远程客户端上的调用方法

[英]Call Method on Remote Client

On a remote client I have a WPF Application running. 在远程客户端上,我正在运行WPF应用程序。
I want to call a function of this application on the client, with a parameter passed from master. 我想使用从master传递的参数在客户端上调用此应用程序的函数。
As far as I understand I have to use a WCF Service. 据我了解,我必须使用WCF服务。
Is that even possible? 那有可能吗? Can you point me to some examples? 你能指出一些例子吗? Thank you in advance. 先感谢您。

UPDATE: I want to call some time-consuming functions from a server on the clients. 更新:我想从客户端的服务器上调用一些耗时的函数。 From the GUI I can define the IPs of the clients. 我可以从GUI定义客户端的IP。 Then I want to call a specific WCF method on the clients. 然后,我想在客户端上调用特定的WCF方法。 However the WCF service is created at runtime on the server. 但是,WCF服务是在服务器上运行时创建的。

As an example I have a WCF Method that opens a MessageBox. 作为示例,我有一个WCF方法可以打开一个MessageBox。 I created a WCF Service and a Self-Hosted REST service for testing. 我创建了一个WCF服务和一个自托管REST服务进行测试。 When I call the Function from clients or server, the MessageBox opens on the server. 当我从客户端或服务器调用函数时,MessageBox在服务器上打开。 Is it possible to call the method from the server, so that the MessageBox appears on the client and not on the server? 是否可以从服务器调用该方法,以使MessageBox出现在客户端而不是服务器上?

Note: I can call the method from the client's Browser, because of the WebGet attribute of the method. 注意:由于方法的WebGet属性,我可以从客户端的浏览器中调用该方法。

I don't think i got you, but if you mean you want to call a remote function, then a web service is the solution, which WCF will provide for you. 我想我不明白您的意思,但是如果您要调用一个远程函数,那么Web服务就是解决方案,WCF将为您提供该解决方案。

create a new WCF and employ the method there, then you can simply call it from anywhere while the WCF is up and running. 创建一个新的WCF并在其中使用该方法,然后您就可以在WCF启动并运行时从任何地方简单地调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM