Compartilhar via


Client-Side Registration

Server-activated and client-activated objects are normally registered in a client application configuration file inside the <client> element to identify remote objects that your application uses. Both server-activated (<wellknown>) types and client-activated (<activated>) types can be specified, but the <wellknown> client instance element supports different attributes than when it is specified under the <service> element. Inside a <client> element, a <wellknown> element can only contain displayName, type and url attributes; any other attributes will raise an exception. For example:

<configuration>
   <system.runtime.remoting>
      <application>
         <client 
            url = "http://www. cpandl.com"
            displayName="MyApplication"
         >
            <wellknown 
               type = "myType,myAssembly"
               url = http://www. cpandl.com/myType.soap"
            />
            <activated 
               type = "myClientActivatedType,myAssembly"
            />
         </client>
      </application>
   </system.runtime.remoting>
</configuration>

The url attribute in the <client> tag points to the location of the remote application. This is the location the application will use when it needs a client-activated object. Each server-activated object has a specific URL pointing to the location of the object.

Configuring a Remoting Client In IIS

If you intend to consume remote services from an ASP.NET application or .NET remoting application hosted in IIS, you must use the Application_Start handler in the Global.asax file to load your configuration file using RemotingConfiguration.Configure() and passing the name of your configuration file. If you place client information in the Web.config file, it will not be picked up automatically, as it is in the case of configuring the server in IIS.

See Also

Registering Remote Objects Using Configuration Files | Configuration | System.Runtime.Remoting.RemotingConfiguration Class | .NET Remoting Overview | Remote Object Configuration