HttpServerChannel.GetUrlsForUri(String) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Geçerli HttpChannelüzerinde barındırılan belirtilen URI'ye sahip bir nesnenin tüm URL'lerinden oluşan bir dizi döndürür.
public:
virtual cli::array <System::String ^> ^ GetUrlsForUri(System::String ^ objectUri);
public virtual string[] GetUrlsForUri (string objectUri);
abstract member GetUrlsForUri : string -> string[]
override this.GetUrlsForUri : string -> string[]
Public Overridable Function GetUrlsForUri (objectUri As String) As String()
Parametreler
- objectUri
- String
URL'lerin gerekli olduğu nesnenin URI'si.
Döndürülenler
Geçerli HttpChannelüzerinde barındırılan belirtilen URI'ye sahip bir nesnenin URL'leri dizisi.
Uygulamalar
Örnekler
Aşağıdaki kod örneğinde yönteminin nasıl kullanılacağı gösterilmektedir GetUrlsForUri . Bu kod örneği, sınıfı için HttpServerChannel sağlanan daha büyük bir örneğin parçasıdır.
#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 ref class HelloService: public MarshalByRefObject{};
int main()
{
// Create a remotable object.
HttpChannel^ httpChannel = gcnew HttpChannel( 8085 );
WellKnownServiceTypeEntry^ WKSTE = gcnew WellKnownServiceTypeEntry( HelloService::typeid,"Service",WellKnownObjectMode::Singleton );
RemotingConfiguration::RegisterWellKnownServiceType( WKSTE );
RemotingConfiguration::ApplicationName = "HelloServer";
// Print out the urls for HelloServer.
array<String^>^urls = httpChannel->GetUrlsForUri( "HelloServer" );
IEnumerator^ myEnum = urls->GetEnumerator();
while ( myEnum->MoveNext() )
{
String^ url = safe_cast<String^>(myEnum->Current);
System::Console::WriteLine( "{0}", url );
}
return 0;
}
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{
}
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
End Class
Açıklamalar
Geçerli yöntem tarafından ChannelServices.GetUrlsForObjectkullanılır.
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin