Compartir a través de


RemotingConfiguration.ApplicationName Propiedad

Definición

Obtiene o establece el nombre de una aplicación de comunicación remota.

public:
 static property System::String ^ ApplicationName { System::String ^ get(); void set(System::String ^ value); };
public static string ApplicationName { get; set; }
member this.ApplicationName : string with get, set
Public Shared Property ApplicationName As String

Valor de propiedad

String

Nombre de una aplicación de comunicación remota.

Excepciones

Al menos uno de los llamadores situados en la parte superior de la pila de llamadas no tiene permiso para configurar los tipos y canales de comunicación remota. Esta excepción se produce únicamente cuando se establece el valor de propiedad.

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la ApplicationName propiedad para indicar el nombre de la aplicación de comunicación remota. Para obtener el código de ejemplo completo, vea ejemplos de los RegisterWellKnownClientType métodos y RegisterWellKnownServiceType .

ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) );
RemotingConfiguration::ApplicationName = "HelloServiceApplication";
RemotingConfiguration::RegisterWellKnownServiceType( HelloService::typeid,
                                                     "MyUri",
                                                     WellKnownObjectMode::SingleCall );
ChannelServices.RegisterChannel(new TcpChannel(8082));

RemotingConfiguration.ApplicationName = "HelloServiceApplication";

RemotingConfiguration.RegisterWellKnownServiceType( typeof(HelloService),
                                                    "MyUri",
                                                    WellKnownObjectMode.SingleCall
                                                  );
ChannelServices.RegisterChannel(New TcpChannel(8082))

RemotingConfiguration.ApplicationName = "HelloServiceApplication"

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

En el ejemplo de código siguiente se muestra cómo obtener acceso a un objeto remoto desde una aplicación con nombre.

ChannelServices::RegisterChannel( gcnew TcpChannel );
RemotingConfiguration::RegisterWellKnownClientType( HelloService::typeid,
                                                    "tcp://localhost:8082/HelloServiceApplication/MyUri" );
HelloService ^ service = gcnew HelloService;
ChannelServices.RegisterChannel(new TcpChannel());

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

HelloService service = new HelloService();
ChannelServices.RegisterChannel(New TcpChannel())

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

Dim service As New HelloService()

Comentarios

Un nombre de aplicación solo se puede establecer una vez, ya sea a través de la propiedad actual o a través de un archivo de configuración. Si una aplicación se ejecuta dentro de un entorno hospedado, como Internet Information Services (IIS), es posible que este valor ya se haya establecido (normalmente en el directorio virtual). La propiedad actual devolverá null si no se ha establecido el nombre de la aplicación.

Se aplica a