RemotingConfiguration.Configure("C:\Config\TaskProcdll.dll.config")If channelTCP Is Nothing Then'taskProcEvents.WriteEntry("TaskSend: channeltcp is nothing")channelTCP = New TcpChannel(internalPort)End IftcpChannelIsRegistered = FalseFor Each Channel In ChannelServices.RegisteredChannelsIf Channel.ChannelName = channelTCP.ChannelName ThentcpChannelIsRegistered = TrueExit ForEnd IfNextIf Not tcpChannelIsRegistered Then ChannelServices.RegisterChannel(channelTCP)taskReceiver = CType(Activator.GetObject(GetType(taskReceiver.TaskReceiver), _"tcp://" & TargetIP & ":" & sendPort & "/" & sendURI), taskReceiver.TaskReceiver)
<configuration>
remoteConfig = "<configuration>" & vbCrLf & "<system.runtime.remoting>" & vbCrLf & _"<application>" & vbCrLf & "<channels>" & vbCrLf & "<channel ref=""tcp"">" & vbCrLf & _"<clientProviders>" & vbCrLf & "<formatter ref=""binary"" />" & vbCrLf & _"<provider type=""EncryptionSink.EncryptionClientSinkProvider, EncryptionSink"" algorithm=""RC2"" keyfile=""c:\Config\key2.dat"" />" & vbCrLf & _"</clientProviders>" & vbCrLf & "</channel>" & vbCrLf & "</channels>" & vbCrLf & "<client>" & vbCrLf & _"<wellknown type=""taskReceiver.TaskReceiver, TaskReceiver"" url=""tcp://" & TargetIP & ":" & sendPort & "/" & sendURI & """ />" & vbCrLf & _"</client>" & vbCrLf & "</application>" & vbCrLf & "</system.runtime.remoting>" & vbCrLf & "</configuration>"configRemote = New FileStream("c:\Config\TaskProcdll.config", FileMode.Create, FileAccess.Write)remoteSW = New StreamWriter(configRemote)remoteSW.WriteLine(remoteConfig)remoteSW.Flush()remoteSW.Close()configRemote.Close()RemotingConfiguration.Configure("C:\Config\TaskProcdll.config")
as I know from your private emails, you already solved parts of this problem
so that I'll just answer the other questions.
> Any ideas? [...]
> Is it possible to mix and match using config files and setting
> the values with Activator.GetType?
Absolutely. And this would be exactly what I'd suggest. Define the channel -
including the custom sinks - in a configuration file but create all
references by using Activator.GetObject() or Activator.CreateInstance().
When doing it this way, your problem with reading the configuration file
multiple times will be solved because you can simply use different URLs in
your source code.
Actually, solving your problem by using a configuration file might be
possible as well but I guess it's way easier when using
Activator.GetInstance() in your case.
HTH,
-Ingo
Author of "Advanced .NET Remoting"
and "Advanced .NET Remoting in VB.NET"
http://www.dotnetremoting.cc
Thx Ingo;
Perhaps you wouldn't mind looking at something else? I've taken your suggestion and the config file looks like this:
and the code looks like this:
Everything appears to work correctly until you hit the line that calls the method on the remoted object:
If
taskReceive.TaskReceive(msmqMessage.Body) Thenwhich throws the error "FileNotFoundException" on it's assembly. I've properly referenced it. I am using the direct assembly, not an interface, I followed the sample apps from MS. The code works if I don't use the config file.
Any help would be greatly appreciated.
Thx
jp
"Ingo Rammer" <ram...@sycom.at> wrote in message news:#FWCOm0GCHA.1600@tkmsftngp13...> Hi Joe,"joe peavey" <jo...@cogenix.com> wrote in message news:#Oc2Lu6GCHA.1744@tkmsftngp13...