次の方法で共有


HttpServerChannel.GetUrlsForUri メソッド

指定した URI を持つオブジェクトのすべての URL のうち、現在の HttpChannel でホストされている URL の配列を返します。

Public Overridable Function GetUrlsForUri( _
   ByVal objectUri As String _) As String() Implements IChannelReceiver.GetUrlsForUri
[C#]
public virtual string[] GetUrlsForUri(stringobjectUri);
[C++]
public: virtual String* GetUrlsForUri(String* objectUri)  __gc[];
[JScript]
public function GetUrlsForUri(
   objectUri : String) : String[];

パラメータ

  • objectUri
    URL を要求するオブジェクトの URI。

戻り値

指定した URI を持つオブジェクトの URL のうち、現在の HttpChannel でホストされている URL の配列。

実装

IChannelReceiver.GetUrlsForUri

解説

現在のメソッドは、 ChannelServices.GetUrlsForObject によって使用されます。

使用例

 
Imports System
Imports System.Runtime.Remoting
Imports System.Runtime.Remoting.Channels.Http

Class SampleClass
   
   Public Shared Sub Main()
      ' Create a remotable object.
      Dim httpChannel As New HttpChannel(8085)
      
      Dim WKSTE As New WellKnownServiceTypeEntry(GetType(HelloService), "Service", WellKnownObjectMode.Singleton)
      RemotingConfiguration.RegisterWellKnownServiceType(WKSTE)
      
      RemotingConfiguration.ApplicationName = "HelloServer"
      
      ' Print out the urls for HelloServer.
      Dim urls As String() = httpChannel.GetUrlsForUri("HelloServer")
      Dim url As String

      For Each url In  urls
         System.Console.WriteLine("{0}", url)
      Next url 
   End Sub 'Main

End Class 'Class1

[C#] 
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels.Http;

class Class1 {
   public static void Main() {

      // Create a remotable object.
      HttpChannel httpChannel = new HttpChannel(8085);

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

      RemotingConfiguration.ApplicationName = "HelloServer";

      // Print out the urls for HelloServer.
      string[] urls = httpChannel.GetUrlsForUri("HelloServer");
      
      foreach (string url in urls)
         System.Console.WriteLine("{0}", url);
      
   }
}

public class HelloService : MarshalByRefObject{

}

[C++] 
#using <mscorlib.dll>
#using <system.dll>
#using <system.runtime.remoting.dll>


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


public __gc class HelloService : public MarshalByRefObject 
{
};

int main() 
{
    // Create a remotable object.
    HttpChannel* httpChannel = new HttpChannel(8085);

    WellKnownServiceTypeEntry* WKSTE = new WellKnownServiceTypeEntry(__typeof(HelloService),
        S"Service", 
        WellKnownObjectMode::Singleton);
    RemotingConfiguration::RegisterWellKnownServiceType(WKSTE);

    RemotingConfiguration::ApplicationName = S"HelloServer";

    // Print out the urls for HelloServer.
    String* urls __gc[] = httpChannel->GetUrlsForUri(S"HelloServer");

    IEnumerator* myEnum = urls->GetEnumerator();
    while (myEnum->MoveNext()) 
    {
        String* url = __try_cast<String*>(myEnum->Current);

        System::Console::WriteLine(S"{0}", url);
    }
    return 0;
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

HttpServerChannel クラス | HttpServerChannel メンバ | System.Runtime.Remoting.Channels.Http 名前空間