This documentation is archived and is not being maintained.
Port.Service Property
.NET Framework 1.1
Gets the Service of which the Port is a member.
[Visual Basic] Public ReadOnly Property Service As Service [C#] public Service Service {get;} [C++] public: __property Service* get_Service(); [JScript] public function get Service() : Service;
Property Value
A Service.
Example
[Visual Basic] ' 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 = _ "http://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 = "http://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"http://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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
Port Class | Port Members | System.Web.Services.Description Namespace
Show: