TcpChannel.GetUrlsForUri(String) Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Zwraca tablicę wszystkich adresów URL obiektu z określonym identyfikatorem URI hostowanym w bieżącym TcpChannelobiekcie .
public:
virtual cli::array <System::String ^> ^ GetUrlsForUri(System::String ^ objectURI);
public string[] GetUrlsForUri (string objectURI);
abstract member GetUrlsForUri : string -> string[]
override this.GetUrlsForUri : string -> string[]
Public Function GetUrlsForUri (objectURI As String) As String()
Parametry
- objectURI
- String
Identyfikator URI obiektu, dla którego są wymagane adresy URL.
Zwraca
Tablica adresów URL obiektu z określonym identyfikatorem URI hostowanym w bieżącym TcpChannelobiekcie .
Implementuje
Przykłady
W poniższym przykładzie kodu pokazano, jak używać tej metody.
#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.
TcpChannel^ tcpChannel = gcnew TcpChannel( 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 );
}
return 0;
}
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Tcp;
class SampleClass {
public static void Main() {
// Create a remotable object.
TcpChannel tcpChannel = new TcpChannel(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);
}
}
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels.Tcp
Class SampleClass
Public Shared Sub Main()
' Create a remotable object.
Dim tcpChannel As New TcpChannel(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
End Class
Uwagi
Ta metoda jest używana przez ChannelServices.GetUrlsForObjectmetodę .