IChannel.Parse(String, String) Метод
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает URI-объект в качестве внешнего параметра и URI текущего канала в качестве возвращаемого значения.
public:
System::String ^ Parse(System::String ^ url, [Runtime::InteropServices::Out] System::String ^ % objectURI);
public string Parse (string url, out string objectURI);
[System.Security.SecurityCritical]
public string Parse (string url, out string objectURI);
abstract member Parse : string * string -> string
[<System.Security.SecurityCritical>]
abstract member Parse : string * string -> string
Public Function Parse (url As String, ByRef objectURI As String) As String
- url
- String
URL-адрес объекта.
- objectURI
- String
При возврате этого метода он содержит объект String, в котором содержится объект URI. Этот параметр передается неинициализированным.
URI текущего канала или null
, если URI не принадлежит этому каналу.
- Атрибуты
У непосредственно вызывающего объекта отсутствует разрешение инфраструктуры.
// Creating the 'IDictionary' to set the server object properties.
IDictionary^ myDictionary = gcnew Hashtable;
myDictionary[ "name" ] = "HttpClientChannel";
myDictionary[ "priority" ] = 2;
// Set the properties along with the constructor.
HttpClientChannel^ myHttpClientChannel = gcnew HttpClientChannel( myDictionary,gcnew BinaryClientFormatterSinkProvider );
// Register the server channel.
ChannelServices::RegisterChannel( myHttpClientChannel );
MyHelloServer ^ myHelloServer1 = dynamic_cast<MyHelloServer^>(Activator::GetObject( MyHelloServer::typeid, "http://localhost:8085/SayHello" ));
if ( myHelloServer1 == nullptr )
System::Console::WriteLine( "Could not locate server" );
else
{
Console::WriteLine( myHelloServer1->myHelloMethod( "Client" ) );
// Get the name of the channel.
Console::WriteLine( "Channel Name :{0}", myHttpClientChannel->ChannelName );
// Get the channel priority.
Console::WriteLine( "ChannelPriority :{0}", myHttpClientChannel->ChannelPriority );
String^ myString;
String^ myObjectURI1;
Console::WriteLine( "Parse :{0}{1}", myHttpClientChannel->Parse( "http://localhost:8085/SayHello", myString ), myString );
// Get the key count.
System::Console::WriteLine( "Keys->Count : {0}", myHttpClientChannel->Keys->Count );
// Get the channel message sink that delivers message to the specified url.
IMessageSink^ myIMessageSink = myHttpClientChannel->CreateMessageSink( "http://localhost:8085/NewEndPoint", nullptr, myObjectURI1 );
Console::WriteLine( "The channel message sink that delivers the messages to the URL is : {0}", myIMessageSink );
Console::WriteLine( "URI of the new channel message sink is: {0}", myObjectURI1 );
}
// Creating the 'IDictionary' to set the server object properties.
IDictionary myDictionary = new Hashtable();
myDictionary["name"]="HttpClientChannel";
myDictionary["priority"]=2;
// Set the properties along with the constructor.
HttpClientChannel myHttpClientChannel =
new HttpClientChannel(myDictionary,new BinaryClientFormatterSinkProvider());
// Register the server channel.
ChannelServices.RegisterChannel(myHttpClientChannel);
MyHelloServer myHelloServer1 = (MyHelloServer)Activator.GetObject(
typeof(MyHelloServer), "http://localhost:8085/SayHello");
if (myHelloServer1 == null)
{
System.Console.WriteLine("Could not locate server");
}
else
{
Console.WriteLine(myHelloServer1.myHelloMethod("Client"));
// Get the name of the channel.
Console.WriteLine("Channel Name :"+myHttpClientChannel.ChannelName);
// Get the channel priority.
Console.WriteLine("ChannelPriority :"+myHttpClientChannel.ChannelPriority.ToString());
string myString,myObjectURI1;
Console.WriteLine("Parse :" +
myHttpClientChannel.Parse("http://localhost:8085/SayHello",out myString)+myString);
// Get the key count.
System.Console.WriteLine("Keys.Count : " + myHttpClientChannel.Keys.Count);
// Get the channel message sink that delivers message to the specified url.
IMessageSink myIMessageSink =
myHttpClientChannel.CreateMessageSink("http://localhost:8085/NewEndPoint",
null,out myObjectURI1);
Console.WriteLine("The channel message sink that delivers the messages to the URL is : "
+myIMessageSink.ToString());
Console.WriteLine("URI of the new channel message sink is: " +myObjectURI1);
}
' Creating the 'IDictionary' to set the server object properties.
Dim myDictionary As New Hashtable()
myDictionary("name") = "HttpClientChannel"
myDictionary("priority") = 2
' Set the properties along with the constructor.
Dim myHttpClientChannel As New _
HttpClientChannel( myDictionary, New BinaryClientFormatterSinkProvider)
' Register the server channel.
ChannelServices.RegisterChannel(myHttpClientChannel)
Dim myHelloServer1 As MyHelloServer = CType(Activator.GetObject(GetType(MyHelloServer), _
"http://localhost:8085/SayHello"), MyHelloServer)
If myHelloServer1 Is Nothing Then
System.Console.WriteLine("Could not locate server")
Else
Console.WriteLine(myHelloServer1.myHelloMethod("Client"))
' Get the name of the channel.
Console.WriteLine("Channel Name :" + myHttpClientChannel.ChannelName)
' Get the channel priority.
Console.WriteLine("ChannelPriority :" + myHttpClientChannel.ChannelPriority.ToString())
Dim myString, myObjectURI1 As String
Console.WriteLine("Parse :" + _
myHttpClientChannel.Parse("http://localhost:8085/SayHello", myString) + myString)
' Get the key count.
System.Console.WriteLine("Keys.Count : " + myHttpClientChannel.Keys.Count.ToString())
' Get the channel message sink that delivers message to the specified url.
Dim myIMessageSink As IMessageSink =myHttpClientChannel.CreateMessageSink( _
"http://localhost:8085/NewEndPoint", Nothing, myObjectURI1)
Console.WriteLine("The channel message sink that delivers the messages to the URL is :" + _
CType(myIMessageSink, Object).ToString)
Console.WriteLine("URI of the new channel message sink is: " + myObjectURI1)
End If
Продукт | Версии |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Отзыв о .NET
.NET — это проект с открытым исходным кодом. Выберите ссылку, чтобы оставить отзыв: