次の方法で共有


Port.Service プロパティ

Port がメンバとして含まれている Service を取得します。

Public ReadOnly Property Service As Service
[C#]
public Service Service {get;}
[C++]
public: __property Service* get_Service();
[JScript]
public function get Service() : Service;

プロパティ値

Service

使用例

 

         ' Create a Port.
         Dim postPort As New Port()
         postPort.Name = "PortServiceHttpPost"
         postPort.Binding = New XmlQualifiedName("s0:PortServiceHttpPost")


         ' Create an HttpAddressBinding.
         Dim postAddressBinding As New HttpAddressBinding()
         postAddressBinding.Location = _
            "https://localhost/PortClass/PortService.vb.asmx"

         ' Add the HttpAddressBinding to the Port.
         postPort.Extensions.Add(postAddressBinding)

         ' Get the Service of the postPort.
         Dim myService As Service = postPort.Service

         ' Print the service name for the port.
         Console.WriteLine("This is the service name of the postPort:*" & _
            myDescription.Services(0).Ports(0).Service.Name & "*")

         ' Add the Port to the PortCollection of the ServiceDescription.
         myDescription.Services(0).Ports.Add(postPort)


[C#] 
// Create a Port.
Port postPort = new Port();
postPort.Name = "PortServiceHttpPost";
postPort.Binding = new XmlQualifiedName("s0:PortServiceHttpPost");

// Create an HttpAddressBinding.
HttpAddressBinding postAddressBinding = new HttpAddressBinding();
postAddressBinding.Location = 
   "https://localhost/PortClass/PortService_cs.asmx";

// Add the HttpAddressBinding to the Port.
postPort.Extensions.Add(postAddressBinding);

// Get the Service of the postPort.
Service myService = postPort.Service;

// Print the service name for the port.
Console.WriteLine("This is the service name of the postPort:*" +
   myDescription.Services[0].Ports[0].Service.Name + "*");

// Add the Port to the PortCollection of the ServiceDescription.
myDescription.Services[0].Ports.Add(postPort);

[C++] 
// Create a Port.
Port* postPort = new Port();
postPort->Name = S"PortServiceHttpPost";
postPort->Binding = new XmlQualifiedName(S"s0:PortServiceHttpPost");

// Create an HttpAddressBinding.
HttpAddressBinding* postAddressBinding = new HttpAddressBinding();
postAddressBinding->Location = 
   S"https://localhost/PortClass/PortService_cs.asmx";

// Add the HttpAddressBinding to the Port.
postPort->Extensions->Add(postAddressBinding);

// Get the Service of the postPort.
Service* myService = postPort->Service;

// Print the service name for the port.
Console::WriteLine(S"This is the service name of the postPort:*{0}*",
   myDescription->Services->Item[0]->Ports->Item[0]->Service->Name);

// Add the Port to the PortCollection of the ServiceDescription.
myDescription->Services->Item[0]->Ports->Add(postPort);

[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 ファミリ

参照

Port クラス | Port メンバ | System.Web.Services.Description 名前空間