Remoting na .NET 2.0

Imamo zanimivo situacijo - nekaj aplikacij na .NET 1.1 deluje brez težav z
remotingom na tcp ali http channelu. Uporabljamo app. server, ki deluje kot
win service in .NET cliente. Če uporabimo VS 2005 oz. .NET 2.0, vse lepo
deluje z remotingom na http chanellu, na tcp pa ne. Pri zagonu clienta se ob
prvem poskusu komunikacije z app. serverjem zgodi naslednji exception:

System.IO.IOException: Unable to read data from the transport connection:
The connection was closed.
at System.Net.Security.NegoState.ProcessAuthentication(LazyAsyncResult
lazyResult)
at
System.Net.Security.NegotiateStream.AuthenticateAsClient(NetworkCredential
credential, String targetName, ProtectionLevel requiredProtectionLevel,
TokenImpersonationLevel allowedImpersonationLevel)
at
System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.CreateAuthenticatedStream(Stream
netStream, String machinePortAndSid)


Ima kdo kakšne izkušnje s tem ali nasvet, kaj povzroča napako in kako jo
odpraviti?

Hvala!
--

Lep pozdrav,
Tomaž
Avtor: tomaz, objavljeno na portalu SloDug.si (Arhiv)

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.

Seldon28
Seldon28 - sreda, 10. oktober 2007

v .NET 2.0 je potrebno malo drugače postaviti Remote saj so ga malo spremenili,recimo po starem je stvar izgledala približno takole:System.Collections.Specialized.ListDictionary channelProperties = new System.Collections.Specialized.ListDictionary();channelProperties.Add("ref", "http");ListDictionary channelProperties = new System.Collections.Specialized.ListDictionary();channelProperties.Add("ref", "http");"ref", "http");System.Collections.Specialized.ListDictionary providerProperties = new System.Collections.Specialized.ListDictionary();ListDictionary providerProperties = new System.Collections.Specialized.ListDictionary();providerProperties.Add("oaep", "false");providerProperties.Add("maxRetries", "1");providerProperties.Add("algorithm", "3DES");"oaep", "false");providerProperties.Add("maxRetries", "1");providerProperties.Add("algorithm", "3DES");"maxRetries", "1");providerProperties.Add("algorithm", "3DES");"algorithm", "3DES");System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider provider = new System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider();BinaryClientFormatterSinkProvider provider = new System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider();provider.Next = new LoPolis.Remoting.SecureClientChannelSinkProvider(providerProperties, null);new LoPolis.Remoting.SecureClientChannelSinkProvider(providerProperties, null);System.Runtime.Remoting.Channels.Http.HttpChannel channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(channelProperties,provider, new LoPolis.Remoting.SecureServerChannelSinkProvider());konfiguracija se spremeni samo v enem delu .... HttpChannel channel = new System.Runtime.Remoting.Channels.Http.HttpChannel(channelProperties,provider, new LoPolis.Remoting.SecureServerChannelSinkProvider());konfiguracija se spremeni samo v enem delu .... new LoPolis.Remoting.SecureServerChannelSinkProvider());konfiguracija se spremeni samo v enem delu .... konfiguracija se spremeni samo v enem delu .... torej če je bilo v  Frameworku 1 to takole    System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel);za Framework 2.0 potem velja                   System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(channel,false);System.Runtime.Remoting.RemotingConfiguration.RegisterWellKnownClientType(new System.Runtime.Remoting.WellKnownClientTypeEntry("remote", GetAsemblyName(Framework), GetURL(Framework)));RemotingConfiguration.RegisterWellKnownClientType(new System.Runtime.Remoting.WellKnownClientTypeEntry("remote", GetAsemblyName(Framework), GetURL(Framework))); Seveda pa smo pri nas, ker uporabljamo .NET 1.1 in .NET 2 v isti aplikaciji, tudi na strežniski strani zagnali nov Remote servis ki deluje z .NET 2. Seveda pa je potrebno vedeti ko enkrat konfiguriraš Remote znotraj aplikacije, ne moreš zadeve rekonfigurirat, niti nemores postavljati novega