简体   繁体   English

WCF服务具有多个端点的单个代理实例

[英]WCF service Single proxy instance with multiple endpoints

I developed a WCF Service hosted in a Windows Service which would send a request to the thirdparty webservice and expects a response.So all i would be given is the url/wsdl information of the thirdparty service where its hosted. 我开发了在Windows服务中托管的WCF服务,该服务会将请求发送到第三方Web服务并期望得到响应。因此,我将得到的只是托管它的第三方服务的url / wsdl信息。

I want to implement say a test service which would give response to my request and Create a single proxy of that service by adding service reference in the visual studio to the actual service.So there can be any number of third party applications which would provide their urls in the future for communication. 我想实现一个测试服务,该服务将响应我的请求,并通过将Visual Studio中的服务引用添加到实际服务中来创建该服务的单个代理。因此,可以有任意数量的第三方应用程序提供它们的服务。以后要进行通信的网址。

My question about the WCF is can i create a single proxy client once and just send the request to a webservice based on the url on the fly ? 关于WCF的问题是,我可以一次创建一个代理客户端,然后根据运行中的URL将请求发送到Web服务吗? Is it possible to use the same proxy client for both HTTP and HTTPS by just passing the binding and address parameters dyanmically ? 通过仅动态地传递绑定和地址参数,是否可以对HTTP和HTTPS使用相同的代理客户端?

Once you have create the proxy you cannot change its address. 创建代理后,您将无法更改其地址。 You could have several open proxies, one per 3rd party. 您可以有多个代理,每个第三方一个。 In addition a single proxy cannot be reused for http and https since they use different bindings (in addition to the reason above). 另外,单个代理不能重复用于http和https,因为它们使用不同的绑定(除了上述原因外)。

One reason for this behavior (which may or may not be relevant in your case) id that proxy can keep state with the server, for example an open security session. 导致代理服务器可以保持服务器状态的一种行为(在您的情况下可能与该情况无关)的一个原因(例如,一个开放的安全会话)。

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

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