Channel Configuration Using BOTH Configuation Files and Programatic channel properties

dotnet framework

    Sponsored Links

    Next

  • 1. Exceptions in channel sinks - why not?
    Ingo Rammer states in his book that channel sinks "must not throw exceptions." Is this true? Can anyone shed a little light on why? Thanks, -Michael
  • 2. How to get Current channel
    I have a server that exposes the class MyClass as singlecall on multiple channels. Clients can obviously call the server using any of the channels and the server will create an instance of MyClass for each call. I need to be able to detect from MyClass which channel the call has been received on, but can't find a way of getting the current channel - even just the port would be good enough. I can do this from within MyClass: string[] retval = System.Runtime.Remoting.Channels.ChannelServices.GetUrlsForObject(this); but this just returns an array with all of the channel URLs. I just want to get the one that the current call is using. Any ideas? Rich
  • 3. <channel> element customProperty attribute
    Hey Guys quick question, <channel ref="tcp" port="8098" customProperty="some prop value" /> I placed the former declaration in my remoting configuration file. Question is, how do I get programatic access to the value in the customProperty attribute programatically from the channel. (of course I don't wanna read the XML from the config file) If anyone has any insight on this, I'd really appreciate it. Cordell Lawrence

Channel Configuration Using BOTH Configuation Files and Programatic channel properties

Postby D Redfield » Sun, 25 Feb 2007 06:07:17 GMT

I have a simple TCP channel remote server and client.  Both of these are 
configured using configuation files.
The Client exe uses a file which contains lines like:
<system.runtime.remoting>

<application>

<channels>

<channel ref="tcp" secure="true" tokenImpersonationLevel="impersonation"  />

</channels>

</application>

</system.runtime.remoting>

After the configuration file is read using:

RemotingConfiguration.Configure(config, true );

I would like to override some of the properties of the channel just 
established.  I don't know how my running client program

gets a reference to the "tcp" channel just established.  There must be a get 
method around here someplace in System.Runtime.Remoting Assembly.



Can anyone point me in the right direction?



thanks.



dlr







Similar Threads:

1.Unregister channel registered using configuration file

I'm trying to unregister a channel which was registered using a
configuration file (using RemotingConfiguration.Configure).

I can't use ChannelServices.Unregister(mychannel), because I do not
have a channel object because I did not register it manually.

I could use:
IChannel this_channel = ChannelServices.GetChannel(my_channel_name);
ChannelServices.UnregisterChannel(this_channel);
but as the channel name is specified in the configuration file, I
don't want to hardcode in the code.

I don't want to unregister all the channels, just the one I'm
currently using.

Is there any way to do this?  Or am I better off just reading the xml
config file for the channel settings and then setting up the channels
programmatically?

2.HELP: How to create different IPC channels in both server and client configuration file

Assumption: both my server and client will use
System.Runtime.Remoting.RemotingConfiguration.Configure(configFile);

to read configuration file

Following are couple of ways I tried, none of them works:
(1)SERVER side:
<configuration>
    <system.runtime.remoting>
    <application>
        <channels>
               <channel ref="ipc" portName="IpcChannelOne"/>
               <channel ref="ipc" portName="IpcChannelTwo"/>
        </channels>

        <service>
                <wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
                                    objectUri="RemoteObjectOne.rem"
                                    mode="Singleton" />

                <wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
                                    objectUri="RemoteObjectTwo.rem"
                                    mode="Singleton" />
        </service>
    </application>
    </system.runtime.remoting>
</configuration>

    CLIENT side:
    <configuration>
        <system.runtime.remoting>
            <application>
                <client>
                    <wellknown type="MyInterface.IRemoteObjectOne, 
InterfaceAssembly"
                                        url="ipc://IpcChannelOne/RemoteObjectOne.rem" 
/>
                    <wellknown type="MyInterface.IRemoteObjectTwo, 
InterfaceAssembly"
                                        url="ipc://IpcChannelTwo/RemoteObjectTwo.rem" 
/>
                </client>
            </application>
        </system.runtime.remoting>
    </configuration>

(2)SERVER side
<configuration>
    <system.runtime.remoting>
        <application>
            <channels>
                   <channel ref="ipc" portName="IpcChannelOne"/>
            </channels>
            <service>
                    <wellknown type="MyServer.RemoteObjectOne, 
ServerAssembly"
                                        objectUri="RemoteObjectOne.rem"
                                        mode="Singleton" />
             </service>

            <channels>
                <channel ref="ipc" portName="IpcChannelTwo"/>
            </channels>
            <service>
                    <wellknown type="MyServer.RemoteObjectTwo, 
ServerAssembly"
                                       objectUri="RemoteObjectTwo.rem"
                                       mode="Singleton" />
            </service>
        </application>
    </system.runtime.remoting>
</configuration>

    CLIENT side:
    no change

(3)SERVER side:
<configuration>
    <system.runtime.remoting>
    <application>
        <service>
                <channels>
                    <channel ref="ipc" portName="IpcChannelOne"/>
                </channels>
                <wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
                                    objectUri="RemoteObjectOne.rem"
                                    mode="Singleton" />
        </service>

        <service>
                <channels>
                    <channel ref="ipc" portName="IpcChannelTwo"/>
                </channels>
                <wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
                                    objectUri="RemoteObjectTwo.rem"
                                    mode="Singleton" />
        </service>
    </application>
    </system.runtime.remoting>
</configuration>

    CLIENT side:
    no change

(4)SERVER side
<configuration>
    <system.runtime.remoting>
    <application>

        <service>
                <channels>
                   <channel ref="ipc" portName="IpcChannelOne"/>
                </channels>
                <wellknown type="MyServer.RemoteObjectOne, ServerAssembly"
                                    objectUri="RemoteObjectOne.rem"
                                    mode="Singleton" />

                <channels>
                    <channel ref="ipc" portName="IpcChannelTwo"/>
                </channels>
                <wellknown type="MyServer.RemoteObjectTwo, ServerAssembly"
                                    objectUri="RemoteObjectTwo.rem"
                                    mode="Singleton" />
        </service>
    </application>
    </system.runtime.remoting>
</configuration>

    CLIENT side:
    no change

Please advise what is the right way to create both client and server side 
configuration files.
Your help is highly appreciated!
Hang 


3.My custom channel blocks exception, but tcp channel does not

On frame 1.1, I made a bi-directional socket channel, when server throws a
custom exception, client always get a RemotingException with "Server
encountered an internal error.  For more information, turn on customErrors
in the server's .config file.", but client can get the correct exception
when I do the same thing with tcp channel. Anybody knows the problem?

Thanks in advance.

Simon


4.Remoting performance channel vs multiple channels

TcpServerChannel channel = new TcpServerChannel("tcpmine",5000);
ChannelServices.RegisterChannel(channel);

MyServiceOne obj1 = new MyServiceOne();
ObjRef oref = RemotingServices.Marshal(obj1,"MyServiceOne");

MyServiceTwo obj2 = new MyServiceTwo();
ObjRef oref2 = RemotingServices.Marshal(obj2,"MyServiceTwo");

This works fine, and now I have two questions.

What are the advantages to creating a new channel on a new port and
have clients access only servicetwo on the second port?

TcpServerChannel channel2 = new TcpServerChannel("tcpmine2",5001);
ChannelServices.RegisterChannel(channel2);

When I say advantages I am thinking performance, throughput or number
of conncurrent clients and I have no idea if sharing a port affects
either.

5.Channel Sinks & Channel Sink providers...

Hi Guys,

I'm trying to build a multi sink chain in code and am having a few
concept issues....

All the examples I've been able to find only feature 1 or 2 sinks but I
need a few more and can't see how to string them together nothing seams
to work does anyone have or know where I can find a simple multi sink
example so that I can get the consepts straight...

Any help most welcome....

Thanks,
Rob.

6. Server Frame always use tcp channel to reply client when server has two registered channels

7. Remoting Client Channels Configuration

8. Problem with Channel Configuration



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 3 guest