ServiceCollection.Insert メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ServiceCollection.Insert メソッドの意味・解説 

ServiceCollection.Insert メソッド

指定した 0 から始まるインデックス番号にある ServiceCollection に、指定した Service インスタンス追加します

名前空間: System.Web.Services.Description
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

例外例外
例外種類条件

IndexOutOfRangeException

index パラメータが 0 未満です。

または

index パラメータCount より大きい値です。

解説解説
使用例使用例
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/ServiceDescription_Read/AddService_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/ServiceDescription_Read/AddService_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.
myServiceDescription.Services.Insert(1, myService)
Service myService = new Service();
myService.Name = "MathService";
XmlQualifiedName myXmlQualifiedName = 
   new XmlQualifiedName("s0:MathServiceSoap");

// Build a new Port for SOAP.
Port mySoapPort = new Port();
mySoapPort.Name = "MathServiceSoap";
mySoapPort.Binding = myXmlQualifiedName;
SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding();
mySoapAddressBinding.Location =
   "http://localhost/ServiceDescription_Read/AddService_CS.asmx";
mySoapPort.Extensions.Add(mySoapAddressBinding);

// Build a new Port for HTTP-GET.
XmlQualifiedName myXmlQualifiedName2 = 
   new XmlQualifiedName("s0:MathServiceHttpGet");
Port myHttpGetPort = new Port();
myHttpGetPort.Name = "MathServiceHttpGet";
myHttpGetPort.Binding = myXmlQualifiedName2;
HttpAddressBinding myHttpAddressBinding = new HttpAddressBinding();
myHttpAddressBinding.Location = 
   "http://localhost/ServiceDescription_Read/AddService_CS.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.
myServiceDescription.Services.Insert(1,myService);
Service^ myService = gcnew Service;
myService->Name = "MathService";
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap"
 );

// Build a new Port for SOAP.
Port^ mySoapPort = gcnew Port;
mySoapPort->Name = "MathServiceSoap";
mySoapPort->Binding = myXmlQualifiedName;
SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding;
mySoapAddressBinding->Location = "http://localhost/ServiceDescription_Read/AddService_CS.asmx";
mySoapPort->Extensions->Add( mySoapAddressBinding );

// Build a new Port for HTTP-GET.
XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet"
 );
Port^ myHttpGetPort = gcnew Port;
myHttpGetPort->Name = "MathServiceHttpGet";
myHttpGetPort->Binding = myXmlQualifiedName2;
HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding;
myHttpAddressBinding->Location = "http://localhost/ServiceDescription_Read/AddService_CS.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.
myServiceDescription->Services->Insert( 1, myService );
Service myService = new Service();
myService.set_Name("MathService");
XmlQualifiedName myXmlQualifiedName = 
    new XmlQualifiedName("s0:MathServiceSoap");

// Build a new Port for SOAP.
Port mySoapPort = new Port();
mySoapPort.set_Name("MathServiceSoap");
mySoapPort.set_Binding(myXmlQualifiedName);
SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding();
mySoapAddressBinding.set_Location(
    "http://localhost/ServiceDescription_Read/AddService_JSL.asmx");
mySoapPort.get_Extensions().Add(mySoapAddressBinding);

// Build a new Port for HTTP-GET.
XmlQualifiedName myXmlQualifiedName2 = 
    new XmlQualifiedName("s0:MathServiceHttpGet");
Port myHttpGetPort = new Port();
myHttpGetPort.set_Name("MathServiceHttpGet");
myHttpGetPort.set_Binding(myXmlQualifiedName2);
HttpAddressBinding myHttpAddressBinding = new HttpAddressBinding();
myHttpAddressBinding.set_Location(
    "http://localhost/ServiceDescription_Read/AddService_JSL.asmx");
myHttpGetPort.get_Extensions().Add(myHttpAddressBinding);

// Add the ports to the service.
myService.get_Ports().Add(myHttpGetPort);
myService.get_Ports().Add(mySoapPort);

// Add the service to the ServiceCollection.
myServiceDescription.get_Services().Insert(1, myService);
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ServiceCollection クラス
ServiceCollection メンバ
System.Web.Services.Description 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ServiceCollection.Insert メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ServiceCollection.Insert メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS