使用 HTTP 的 WCF 客户端是否可以调用返回 HTTPS 的 WCF 服务,或者该服务是否可以重定向到 HTTPS svc?
我的任务是通过 HTTP 接收 WCF 客户端调用,并通过 HTTPS 从 WCF 服务返回值。起初,我使用 global.asax 接受对 HTTP 服务地址的调用,然后将它们重定向到 HTTPS 服务地址。然而,WCF 客户端抛出了一个错误。
是否可以让 WCF 客户端通过 HTTP 调用 WCF 服务,然后让该 WCF 服务通过 HTTPS 返回消息?非常感谢您的任何想法和建议。帮助。
I've been tasked to receive a WCF client call over HTTP and to return the values from the WCF service over HTTPS. At first, I was using a global.asax to take calls to the HTTP service address and then redirect them to the HTTPS service address. However, the the WCF client threw an error.
Is it possible to have a WCF client make a call to a WCF service over HTTP, and then have that WCF service return a message over HTTPS? Thank-you very much for any ideas & help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您没有使用某种双工机制,那么不,这是不可能的。客户端通过 tcp 发起 http/https 连接,并通过同一连接实例返回数据。
Assuming you are not using some sort of duplexing mechanism, then no, this isn't possible. The client initiates the http/https connection over tcp and the data is returned over the same connection instance.
连接的建立方式不允许在请求和相关应答之间更改传输协议。至少,这适用于常规 http 或 https 连接(WCF 每次调用)。
但是,当您尝试设置双工通道时,也许可以实现此目的。对于双工通信,客户端有效地发布一个端点,服务器可以回调该端点以通过新连接发布答案。这可能使客户端有机会发布 https 端点,而服务器发布 http 端点。
请访问 http://msdn.microsoft.com/en-us/library/ms731064 .aspx 了解有关如何设置双工 WCF 通信通道的详细信息。
The way a connection is setup does not allow the transport protocol to be changed between the request and the associated answer. At least, this goes for the regular http or https connection (WCF Per call).
However, when you try to setup a duplex channel, it might be possible to achieve this. For duplex communication the client effectively publishes an endpoint that the server can call-back to to post the answer over a new connection. This might give the opportunity to have the client publish an https endpoint while the server publishes a http endpoint.
Please visit http://msdn.microsoft.com/en-us/library/ms731064.aspx for details on how to setup a Duplex WCF communication channel.