This documentation is archived and is not being maintained.

RemotingConfiguration.ApplicationName Property

Gets or sets the name of a remoting application.

[Visual Basic]
Public Shared Property ApplicationName As String
[C#]
public static string ApplicationName {get; set;}
[C++]
public: __property static String* get_ApplicationName();
public: __property static void set_ApplicationName(String*);
[JScript]
public static function get ApplicationName() : String;
public static function set ApplicationName(String);

Property Value

The name of a remoting application.

Exceptions

Exception Type Condition
SecurityException At least one of the callers higher in the callstack does not have permission to configure Remoting types and channels. This exception is thrown only when setting the property value.

Remarks

An application name can be set only once, either through the current property or through a configuration file. If an application is running inside a hosted environment, such as Internet Information Services (IIS), this value might have already been set (usually to the virtual directory). The current property will return a null reference (Nothing in Visual Basic) if the application name has not been set.

Example

[Visual Basic, C#, C++] The following example demonstrates the use of the ApplicationName property to indicate the name of the remoting application. For the full example code, see examples for the RegisterWellKnownClientType and RegisterWellKnownServiceType methods.

[Visual Basic] 
ChannelServices.RegisterChannel(New TcpChannel(8082))

RemotingConfiguration.ApplicationName = "HelloServiceApplication"

RemotingConfiguration.RegisterWellKnownServiceType(GetType(HelloService), "MyUri", WellKnownObjectMode.SingleCall)

[C#] 
ChannelServices.RegisterChannel(new TcpChannel(8082));

RemotingConfiguration.ApplicationName = "HelloServiceApplication";

RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloService),
                                                    "MyUri",
                                                    WellKnownObjectMode.SingleCall 
                                                  );

[C++] 
ChannelServices::RegisterChannel(new TcpChannel(8082));

RemotingConfiguration::ApplicationName = S"HelloServiceApplication";

RemotingConfiguration::RegisterWellKnownServiceType(__typeof(HelloService),
    S"MyUri",
    WellKnownObjectMode::SingleCall);

[Visual Basic, C#, C++] The following example demonstrates how to access an object remoted from a named application.

[Visual Basic] 
ChannelServices.RegisterChannel(New TcpChannel())

RemotingConfiguration.RegisterWellKnownClientType(GetType(HelloService), "tcp://localhost:8082/HelloServiceApplication/MyUri")

Dim service As New HelloService()

[C#] 
ChannelServices.RegisterChannel(new TcpChannel());

RemotingConfiguration.RegisterWellKnownClientType(
                                                   typeof(HelloService),
                                                   "tcp://localhost:8082/HelloServiceApplication/MyUri"
                                                 );

HelloService service = new HelloService();

[C++] 
ChannelServices::RegisterChannel(new TcpChannel());

RemotingConfiguration::RegisterWellKnownClientType(__typeof(HelloService),
    S"tcp://localhost:8082/HelloServiceApplication/MyUri");

HelloService* service = new HelloService();

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

RemotingConfiguration Class | RemotingConfiguration Members | System.Runtime.Remoting Namespace

Show: