简体   繁体   English

在另一个WCF服务中调用WCF服务对象方法

[英]calling a WCF service object method in another WCF service

I using two WCF services. 我使用两个WCF服务。 WCF service A is hosted in my .NET Winform application and WCF Service B is hosted on a Windows Service. WCF服务A托管在我的.NET Winform应用程序中,而WCF服务B托管在Windows服务上。

I am able to instantiate a client for WCF Service B and use the methods - ie call the WCF service hosted on Windows service from the .NET Winform app. 我能够实例化WCF服务B的客户端并使用方法-即从.NET Winform应用程序调用Windows服务上托管的WCF服务。

I am not able to accomplish the reverse with WCF Service A - ie call the WCF Service hosted on the .NET Winform application from the Windows Service. 我无法使用WCF服务A完成反向操作,即从Windows Service调用.NET Winform应用程序上托管的WCF服务。 The call to the method times out. 该方法的调用超时。

I have used the WCF Test client from the Visual Studio command prompt and it can successfully make calls to WCF Service A. 我已经从Visual Studio命令提示符中使用了WCF测试客户端,它可以成功地调用WCF服务A。

Is this due to a security issue or something from the Windows Service? 这是由于安全问题还是Windows服务的问题?

Please advise. 请指教。

Thanks in advance! 提前致谢!

Subbu 子部

I think the only viable approach (without the extreme of having some messaging infrastructure), is to have the service invoke operations back on your client via a WCF callback. 我认为唯一可行的方法(在没有某些消息传递基础结构的情况下)是使服务通过WCF回调在客户端上调用操作。 A good example of this can be found here: 一个很好的例子可以在这里找到:

What steps do I need to take to use WCF Callbacks? 使用WCF回调需要采取什么步骤?

This is good for dealing with events that happen server side and allowing the client to respond to them. 这对于处理服务器端发生的事件并允许客户端响应它们很有好处。 If events isn't what you're looking for, then your client could just register with the server (specifying the callback contract), and then the server can invoke your client at will. 如果事件不是您想要的,那么您的客户端可以只在服务器上注册(指定回调合同),然后服务器可以随意调用您的客户端。

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

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