Freigeben über


TcpServerChannel.GetUrlsForUri-Methode

Gibt ein Array sämtlicher URLs für ein Objekt mit dem angegebenen URI zurück, für das die aktuelle TcpChannel-Instanz als Host fungiert.

Namespace: System.Runtime.Remoting.Channels.Tcp
Assembly: System.Runtime.Remoting (in system.runtime.remoting.dll)

Syntax

'Declaration
Public Overridable Function GetUrlsForUri ( _
    objectUri As String _
) As String()
'Usage
Dim instance As TcpServerChannel
Dim objectUri As String
Dim returnValue As String()

returnValue = instance.GetUrlsForUri(objectUri)
public virtual string[] GetUrlsForUri (
    string objectUri
)
public:
virtual array<String^>^ GetUrlsForUri (
    String^ objectUri
)
public String[] GetUrlsForUri (
    String objectUri
)
public function GetUrlsForUri (
    objectUri : String
) : String[]

Parameter

  • objectUri
    Der URI des Objekts, für das URLs erforderlich sind.

Rückgabewert

Ein Array der URLs für ein Objekt mit dem angegebenen URI, für das die aktuelle TcpChannel-Instanz als Host fungiert.

Hinweise

Diese Methode wird von ChannelServices.GetUrlsForObject verwendet.

Beispiel

Im folgenden Codebeispiel wird die Verwendung der GetUrlsForUri-Methode veranschaulicht.

Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels.Tcp


Class SampleClass
   
   Public Shared Sub Main()
      ' Create a remotable object.
      Dim tcpChannel As New TcpServerChannel(8085)
      
      Dim WKSTE As New WellKnownServiceTypeEntry(GetType(HelloService), "Service", WellKnownObjectMode.Singleton)
      RemotingConfiguration.RegisterWellKnownServiceType(WKSTE)
      
      RemotingConfiguration.ApplicationName = "HelloServer"
      
      ' Print out the urls for the HelloServer.
      Dim urls As String() = tcpChannel.GetUrlsForUri("HelloServer")
      Dim url As String
      
      For Each url In  urls
         System.Console.WriteLine("{0}", url)
      Next url 
   End Sub 'Main
   
End Class 'Class1
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Tcp;

class Class1 {
   public static void Main() {

      // Create a remotable object.
      TcpServerChannel tcpChannel = new TcpServerChannel(8085);

      WellKnownServiceTypeEntry WKSTE = 
         new WellKnownServiceTypeEntry(typeof(HelloService),
                                       "Service", 
                                       WellKnownObjectMode.Singleton);
      RemotingConfiguration.RegisterWellKnownServiceType(WKSTE);

      RemotingConfiguration.ApplicationName = "HelloServer";

      // Print out the urls for the HelloServer.
      string[] urls = tcpChannel.GetUrlsForUri("HelloServer");
      
      foreach (string url in urls)
         System.Console.WriteLine("{0}", url);
      
   }
}
#using <system.dll>
#using <system.runtime.remoting.dll>
#using "service.dll"

using namespace System;
using namespace System::Runtime::Remoting;
using namespace System::Runtime::Remoting::Channels::Tcp;
using namespace System::Collections;

int main()
{
   // Create a remotable object.
   TcpServerChannel^ tcpChannel = gcnew TcpServerChannel( 8085 );

   WellKnownServiceTypeEntry^ WKSTE =
      gcnew WellKnownServiceTypeEntry( HelloService::typeid,
         "Service",
         WellKnownObjectMode::Singleton );
   RemotingConfiguration::RegisterWellKnownServiceType( WKSTE );

   RemotingConfiguration::ApplicationName = "HelloServer";
   
   // Print out the urls for the HelloServer.
   array<String^>^ urls = tcpChannel->GetUrlsForUri( "HelloServer" );

   for each ( String^ url in urls )
   {
      System::Console::WriteLine( "{0}", url );
   }
}

.NET Framework-Sicherheit

  • Volle Vertrauenswürdigkeit für den unmittelbaren Aufrufer. Dieser Member kann von nur teilweise vertrauenswürdigem Code nicht verwendet werden. Weitere Informationen finden Sie unter .

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

TcpServerChannel-Klasse
TcpServerChannel-Member
System.Runtime.Remoting.Channels.Tcp-Namespace