Re: Delegate Failure after Migration to .NET 2.0 - Vista

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Bram,

Thanks for your response.

Are you saying that you had to make the below calls - in order for
remoting to work in .NET 2.0 for you?

ActivatedClientTypeEntry entry = new
ActivatedClientTypeEntry(typeof(PokerClient), url);
RemotingConfiguration.ApplicationName = "Poker";
RemotingConfiguration.RegisterActivatedClientType(entry);


I make the single below call in order to register my server type. All
my objects are server activated, and their proxy is obtained using the
Proxy Factory Pattern. But the event delegates are passed from the
client to a notification service, a hosted service in my server, and
stored in a list. When anyone publishes an event, the notification
service fires the appropriate delegate it has previous obtained from
the client.

RemotingConfiguration.RegisterWellKnownServiceType(
typeof(IService), objectUri, WellKnownObjectMode.Singleton);


I set the TypeFilterLevel to Full to allow the server to call back to
the client through the tcp channel.

It is this call that has the problem with the tcp remoting channel and
throws the socket exception, only in .NET 2.0.


Victor Grippi




On Jul 15, 7:45 am, Bram <b.fo...@xxxxxxxxx> wrote:
Hey Victor,

Remoting became a lot harder to get right in .NET 2.0 and
unfortunately there is not that many good documentation, since most
snippets out there don't actually work in .NET 2.0. So frankly, I
think for once it's NET 2.0 and not Vista which is the culprit. After
a *lot* of trial and error, I came up with the following code which
happily allows for raising exceptions, etc...:

Server setup

IDictionary props = new Hashtable();
props["port"] = 19681;
BinaryServerFormatterSinkProvider ssp = new
BinaryServerFormatterSinkProvider();
ssp.TypeFilterLevel = TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider csp = new
BinaryClientFormatterSinkProvider();
TcpChannel myChannel = new TcpChannel(props, csp, ssp);
ChannelServices.RegisterChannel(myChannel, false);
ActivatedServiceTypeEntry entry = new
ActivatedServiceTypeEntry(typeof(PokerClient));
RemotingConfiguration.ApplicationName = "Poker";
RemotingConfiguration.RegisterActivatedServiceType(entry);

Client setup

IDictionary props = new Hashtable();
props["port"] = 0;
BinaryServerFormatterSinkProvider ssp = new
BinaryServerFormatterSinkProvider();
ssp.TypeFilterLevel = TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider csp = new
BinaryClientFormatterSinkProvider();
TcpChannel myChannel = new TcpChannel(props, csp, ssp);
ChannelServices.RegisterChannel(myChannel, false);
string url = "tcp://" + hostname + ":19681/Poker";
ActivatedClientTypeEntry entry = new
ActivatedClientTypeEntry(typeof(PokerClient), url);
RemotingConfiguration.ApplicationName = "Poker";
RemotingConfiguration.RegisterActivatedClientType(entry);
object[] urlParm = { new UrlAttribute(url) };
PokerClient client = new PokerClient();

I hope this helps!

Regards,
Bram

On 15 jul, 00:53, VictorG <grippiconsult...@xxxxxxxxx> wrote:



Hello,

I am converting a C# .NET 1.1 based system to .NET 2.0. I am
encountering a socket exception with delegate events. The system uses
an NT service as a remoting host that provides services that desktop
applications consume.

Exception Message:
SocketException : No connection could be made because the target
machine actively refused it.

We are using the tcp remoting channel with the binary formatter. This
works in Vista with .NET 1.1, but not in 2.0 Vista, with UAC on or
off. No other code has been changed, I only migrated the project
files, and tried to run.

The events are fired from the remoting host (service) back to the
client (desktop) in another process.

Here is how I initialize the tcp channel in the client, (basically the
same as server):
******************************************************************
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();

IDictionary props = new Hashtable();
props["port"] = 0;
props["name"] = "ESF Channel";
props["machineName"] = "localhost";

ChannelServices.RegisterChannel(new TcpChannel(props, clientProv,
serverProv));

**************************************************************

Are there any known issues with the tcp channel and delegates in .NET
2.0/Vista?
Could this be a CAS security related problem?

Any help will be greatly appreciated.

Thanks,
Victor Grippi- Hide quoted text -

- Show quoted text -


.



Relevant Pages

  • Re: Events in .Net Remoting
    ... I am writing with respect to the Events in .Net Remoting that I had ... another channel for the callbacks..both on client side. ... Then I force a method on the server end (through a GUI control on the ... >> the regular client side requests still work fine. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: passing structs (setializable) object in web service
    ... The philosophy of webservices is different than that of remoting. ... follow Seely's advice as Christoph pointed out earlier - you have to modify ... > having total control over both client and server types. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Reuse of Remoting Channels...
    ... makes it possible for the server to know the identity of the caller. ... If my client is on the other side of a Windows 'realm' (as in the ... RemotingConfiguration options) to reject any clients whose credentials ... "Remoting server cannot be reached. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: soapsuds
    ... pre-instantiated exe running in a singleton mode, for remoting, even if you ... Revised framework implementations will probably not break your application ... We can then compile the client using this code which allows us ... Both client and server are ...
    (microsoft.public.dotnet.framework.remoting)
  • RE: Need advise on concept ???
    ... Machine information are based on alarms (imagin your ca with a red ... remoting, messaging etc - I think your time might be better spent by ... each could be hosted in a server cluster (fronted by a load ... id on the appropriate IServerPlugIn assembly/class and then execute the ...
    (microsoft.public.dotnet.distributed_apps)