RemotingConfiguration.ApplicationName Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le nom d’une application de communication à distance.
public:
static property System::String ^ ApplicationName { System::String ^ get(); void set(System::String ^ value); };
public static string ApplicationName { get; set; }
static member ApplicationName : string with get, set
Public Shared Property ApplicationName As String
Valeur de propriété
Nom d’une application de communication à distance.
Exceptions
Au moins un des appelants plus haut dans la pile d’appels n’est pas autorisé à configurer les types et canaux de communication à distance. Cette exception est levée uniquement lors de la définition de la valeur de la propriété.
Exemples
L’exemple de code suivant illustre l’utilisation de la ApplicationName propriété pour indiquer le nom de l’application de communication à distance. Pour obtenir l’exemple de code complet, consultez des exemples pour les méthodes et RegisterWellKnownServiceType les RegisterWellKnownClientType méthodes.
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)
L’exemple de code suivant montre comment accéder à un objet distant à partir d’une application nommée.
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()
Remarques
Un nom d’application ne peut être défini qu’une seule fois, via la propriété actuelle ou via un fichier de configuration. Si une application s’exécute à l’intérieur d’un environnement hébergé, tel qu’Internet Information Services (IIS), cette valeur a peut-être déjà été définie (généralement sur le répertoire virtuel). La propriété actuelle retourne null si le nom de l’application n’a pas été défini.