WCF和放大器; ASP.NET:使用AJAX全双工支持放大器、全双工、WCF、ASP

2023-09-10 20:16:44 作者:感情刀下鬼

我知道WSDualHttpBinding,NetTcpBinding的,并NetPeerTcpBinding绑定都支持全双工/回调服务操作。

我无法找到在互联网上,甚至有人询问是否双面打印以某种方式支持Ajax调用的任何地方。也许我无法找到关于这事的原因是因为我完全误解了一些关键的WCF概念,使问题的最愚蠢的问题,有...

我知道的WebHttpBinding与&LT以及结合; enableWebScript /> gneerates必要的代理JS对象的客户端

这是不可能的,因为双面打印服务需要有一个callbackservice被托管,也没有办法做到这一点的客户端? (如果是有道理的。)

我的应用程序是分层如下: 1.的WebSite1 - AJAX调用WebSite1.MyClientService 。 2. WebSite1.MyClientService - WCF自托管服务,它引用MyServiceProxies DLL 。 3. MyServiceProxies DLL - 自定义代理服务器(用来代替添加服务引用自动生成的代理服务器)自ClientBase继承。这仅仅代表实际的服务调用出来base.Channel.OperationName()在[为MyService:IMyService在WINSERVICE WCF主机EXE]。 4. WINSERVICE WCF主机EXE - 这是正在作为一个窗口服务,为单身,使多线程调用。从该的WebSite1电话查询此单持有的内存值。此单将最终提交通过单独的数据层内存召开数据库中的所有数据。

的WINSERVICE配置为使用双工电话了的net.tcp。该WINSERVICE将运行在同一台机器上的IIS的WebSite1应用程序。

解决方案   

我无法找到在互联网上的任何地方   有人甚至要求如果双工是   不知何故支持Ajax调用。   也许我无力的原因   找到这样的东西是因为我   完全误解了一些关键   WCF的概念,使问题   最愚蠢的问题,有...

不是哑巴,也许,因为我认为这是AJAX你不理解,不WCF。

这并没有真正意义的具有AJAX双面打印合同。双工合同有权要求服务器调用承包经营在任何时间。它不喜欢发布/订阅,例如,或索取反应,其中客户端的行动是必要的消息开始之前到达。带有双面打印的合同,消息可能到达任何时候。

谁来听他们的?不是浏览器。如果浏览器是什么反应到主动提供的消息从一些远程机器进来,然后运行code - ?好吧,这听起来很像病毒的定义,是不是

我不认为你会发现双面合约支持JavaScript的很长一段时间。

I know that WSDualHttpBinding, NetTcpBinding, and NetPeerTcpBinding bindings all support duplex/callback service operations.

I can't find anywhere on the internet anyone even asking if duplex is somehow supported for ajax calls. Maybe the reason for my inability to find anything on this is because I am completely misunderstanding some key WCF concept that makes the question the dumbest question there is...

wcf入门 5 双工模式

I know that the webHttpBinding binding along with <enableWebScript/> gneerates the js necessary for proxy objects client-side.

Is this impossible because duplex services need that callbackservice to be hosted and there is no way to do that client-side ? (If that makes sense..)

My app is layered as follows: 1. WebSite1 - ajax calls to WebSite1.MyClientService. 2. WebSite1.MyClientService - WCF Self-hosted service that references MyServiceProxies DLL. 3. MyServiceProxies DLL - Custom proxies (used instead of "Add Service reference" auto-generated proxies) that inherit from ClientBase. This simply delegates actual service calls out to base.Channel.OperationName() at [MyService : IMyService at WinService WCF Host EXE]. 4. WinService WCF Host EXE - This is running as a windows service, as a singleton, allowing multi-threaded calls. The calls from WebSite1 query the in-memory values held by this singleton. This singleton will eventually commit all data held in-memory to database via seperate data layer.

The WinService is configured to use duplex calls over net.tcp. The WinService will run on same machine as WebSite1 IIS App.

解决方案

I can't find anywhere on the internet anyone even asking if duplex is somehow supported for ajax calls. Maybe the reason for my inability to find anything on this is because I am completely misunderstanding some key WCF concept that makes the question the dumbest question there is...

Not dumb, maybe, because I think it's AJAX you don't understand, not WCF.

It doesn't really make sense to have a duplex contract in AJAX. A duplex contract has to expect the server to call the contract operations at any time. It's not like publish/subscribe, for instance, or solicit response, where an action by the client is necessary before messages start arriving. With a duplex contract, messages could arrive at any time.

Who's going to listen to them? Not the browser. If the browser were going to react to unsolicited messages coming in from some remote machine and then running code - well, that sounds a lot like the definition of a virus, doesn't it?

I don't think you're going to find support for duplex contracts in JavaScript for quite some time.