I had several clues that server-side asynchronous processing was not
implemented in .NET Remoting, but now I have proof: download the Shared
Source CLI 2.0 (codename "Rotor") and look for a file called
ChannelServices.cs (actually it's in sscli20
/clr/src/bcl/system/runtime/remoting).  Go to line 705 and you'll see the
following commented-out code:

                    /*
                        FUTURE:
                        Dispatching asynchronously was cut from v1. We
should reactivate
                        the following code in v1.x or v2.

                    // look for async method version
                    MethodInfo begin;
                    MethodInfo end;
                    ServerChannelSinkStack serverSinkStack = sinkStack as
ServerChannelSinkStack;
                    if ((sinkStack != null) &&
                        cache.GetAsyncMethodVersion(out begin, out end))
                    {
                        processing = ServerProcessing.Async;
                        IMessage asyncMsg =
                            new AsyncMethodCallMessageWrapper(
                                (IMethodCallMessage)msg,
                                begin,
                                new AsyncCallback
(sinkStack.ServerCallback),
                                null);
                        serverSinkStack.AsyncMessage = asyncMsg;
                        serverSinkStack.AsyncEnd = end;
                        serverSinkStack.Message = (IMethodCallMessage)msg;
                        asyncMsg.Properties["__SinkStack"] = sinkStack;

                        // We don't dispatch yet. That happens when the
server transport sink
                        //   eventually calls sinkStack.StoreAndDispatch
(...).
                    }
                    else
                    */

This explains why functions like IMessageSink.AsyncProcessMessage and
IServerChannelSink.AsyncProcessResponse never get called on the server
side, and why IServerChannelSink.ProcessMessage never returns
ServerProcessing.Async.  Furthermore, it means there are entire sections of
code that were supposed to support asynchronous server-side processing but
since this mechanism was abandoned, they never get executed.

The way it was supposed to work is apparent from the above snippet: the
server was supposed to look for an asynchronous version of the target
method (i.e., a Begin*/End* pair of methods that match the name and
signature of the original method) and use that to invoke the method
asynchronously.  When the operation would complete, the ServerSinkStack
would come into play and report the results back to all the sinks that
pushed themselves onto it.

I also found this link where this guy claims he was able to get it to work,
but it required some "massaging," as he calls it:

http://www.rikware.com/WebLog/September2005.html

The thing that most amazes me, however, is that both Ingo Rammer in his
book "Advanced .NET Remoting" and the Microsoft Press book on the same
subject completely fail to mention the fact that this mechanism is not
operational.

Regards,

Ron

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to