是否可以从 WCF 回调到 ASP.NET?
我在不同的盒子中的 IIS 中托管了一个 Web 服务,在另一个盒子中的 Windows 服务中托管了 WCF 服务。(N 层方法)。这里,Web服务是WCF服务的客户端。上传文件的请求到达 IIS 托管的 Web 服务,该 IIS 托管的 Web 服务反过来调用 WCF 服务并执行实际的上传。到目前为止,一切都很好。上传完成后,WCF 服务执行回调(我已将回调存储在字典中,并且使用了 (InstanceContextMode=InstanceContextMode.PerSession, ConcurrencyMode=ConcurrencyMode.Multiple))。 WCF 服务发送回调。在跟踪查看器中,看起来 ASP.NET 收到了回调,但浏览器中的上传页面(这是最终用户)永远冻结了。 我正在使用 larsw 的 ChunkingChannel 绑定。
首先,是否有可能实现上述方案,正如 John Saundars 在此链接中提到的:
“OperationContext.Current.GetCallbackChannel”实际上是做什么的?
感谢您的帮助。
I have a Web service hosted in IIS in different box and WCF service hosted in Windows service, in a different box.(N-tier approach). Here, Web service is a client for WCF service. The request to upload the file comes to the IIS hosted Web service, and this IIS hosted Web service in return calls the WCF service and does the actual upload. So far so good. After the upload is done the WCF service performs the callback (I have stored the callbacks in dictionary, and I have used (InstanceContextMode=InstanceContextMode.PerSession, ConcurrencyMode=ConcurrencyMode.Multiple)). The WCF service sends the callback. In the trace viewer, it looks like the ASP.NET received the callback, but the upload page in browser(this is the end user) freezes for good.
I am using ChunkingChannel binding by larsw.
First of all, is it at all possible to implement the above senario, as John Saundars mentioned in this link:
What does "OperationContext.Current.GetCallbackChannel" actually do?
Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
奇怪的是,我重新启动了计算机,现在在客户端 (ASP.NET) 端的跟踪查看器中看到以下内容,而且页面现在不会冻结(无响应)。最让我担心的消息是它的内部异常:System.NullReferenceException,mscorlib 并说对象引用不是...
我尝试使用控制台应用程序作为 WCF 服务的客户端。回调效果很好。仅当我在 IIS 中托管我的网站并调用 WCF 服务上传文件时(返回回调到客户端以通知上传成功/不成功)。
(我正在使用 HttpChunkingBinding)。
有什么想法吗?
It is weired, I restarted the computer and now am getting the following in Trace viewer in the client (ASP.NET) side, and also the page doesn't freezes(unresponsive) now. The message that most concerns me is its inner exception: System.NullReferenceException, mscorlib and says Object reference not...
I tried with Console Application as a client to WCF Service. The callback works great. It is only when I host my website in IIS and call WCF service to upload file(which in return calls back to the client to notify that the upload was/not successful).
(I am using HttpChunkingBinding).
Any idea?
不确定您所说的“冻结”是什么意思,这只是它不更新还是变得无响应。
可能是在响应从 wcf 服务返回到 Web 服务器之前,asp 页面的响应已发送到浏览器。在这种情况下,当结果从服务返回时,asp 页面将不会更新。
您有 2 个选择:
如果您最终等待回调,那么仅执行请求响应样式会更简单。
另一个常见问题是客户端上的 wcf 代理在收到回调之前关闭。痕迹显示它回来了,但没有人在听。
Not sure what you mean by "freezes", is this just that it does not update or that it becomes unresponsive.
It may be that the response for the asp page is sent to the browser before the response comes back to the web server from the wcf service. In this case the asp page will not get updated when the result comes back from the service.
You have 2 options:
If you endup waiting for the call back, then it would be simpler just to do a request response style.
Another common probliem is that the wcf proxy on the client gets closed before the callback is received. The trace would show it coming back, but nobody is listening.