Different ways to activate CLR types remotely


A CLR type instance can be activated remotely in the following ways:

1. Through Config: This is probably the most common way. Use the client tag under system.runtime.remoting to register a type to go remote:
<configuration>
  <system.runtime.remoting>
    <application>
      <client>
        <wellknown type=”Hello.HelloService, Hello” url=”http://localhost:8000/HelloService.soap” />
        <activated type=”Hello.HelloActivatedService, Hello” url=”http://localhost:8000” />
      </client>
    </application>
  </system.runtime.remoting>
</configuration>

2. RegisterWellKnownClientType or RegisterActivatedClientType: If using a configuration file is not suitable, use these RemotingConfiguration APIs to register types to go remote programmatically.

3. Activator.CreateInstance: (for CAO) Use CreateInstance with the UrlAttribute to activate types remotely. CreateInstance could be used when you need to activate the same type on different servers. The other two methods are static per appdomain, meaning once registered all type activations are done remotely. CreateInstance with UrlAttribute gives a way to selectively activate types remotely.

4. Activator.GetObject: This is the CreateInstance equivalent for WKO. This is a way to generate wellknown proxies for the same type at different endpoints

5. RemotingServices.Connect: This is just an alias for Activator.GetObject. Does the exact same thing

 


Comments (2)

  1. AndrewSeven says:

    system.runtime.remoting has some of the worst names I have seen in config.

    I pretty much memorized them for the exam, ’cause they don’t make a lot of sense.

  2. ManishG says:

    Can you please elaborate which config entries werent intuitive? What exam did you have to memorize remoting entries for? Isnt there documentation you could refer to?

    Thanks for the feedback.