ServiceCollection.Add Method (Service)
.NET Framework (current version)
Adds the specified Service to the end of the ServiceCollection.
Assembly: System.Web.Services (in System.Web.Services.dll)
Parameters
- service
-
Type:
System.Web.Services.Description.Service
The Service instance to add to the collection.
' Build a new Service. Dim myService As New Service() myService.Name = "MathService" Dim myXmlQualifiedName As New XmlQualifiedName("s0:MathServiceSoap") ' Build a new Port for SOAP. Dim mySoapPort As New Port() mySoapPort.Name = "MathServiceSoap" mySoapPort.Binding = myXmlQualifiedName Dim mySoapAddressBinding As New SoapAddressBinding() mySoapAddressBinding.Location = _ "http://localhost/ServiceCollection_Item/AddSub.vb.asmx" mySoapPort.Extensions.Add(mySoapAddressBinding) ' Build a new Port for HTTP-GET. Dim myXmlQualifiedName2 As _ New XmlQualifiedName("s0:MathServiceHttpGet") Dim myHttpGetPort As New Port() myHttpGetPort.Name = "MathServiceHttpGet" myHttpGetPort.Binding = myXmlQualifiedName2 Dim myHttpAddressBinding As New HttpAddressBinding() myHttpAddressBinding.Location = _ "http://localhost/ServiceCollection_Item/AddSub.vb.asmx" myHttpGetPort.Extensions.Add(myHttpAddressBinding) ' Add the ports to the service. myService.Ports.Add(myHttpGetPort) myService.Ports.Add(mySoapPort) ' Add the service to the ServiceCollection. myServiceCollection.Add(myService)
.NET Framework
Available since 1.1
Available since 1.1
Show: