ServiceDescriptionImporter.AddServiceDescription 方法

定義

將指定的 ServiceDescription 加入要匯出的 ServiceDescriptions 值集合。

public:
 void AddServiceDescription(System::Web::Services::Description::ServiceDescription ^ serviceDescription, System::String ^ appSettingUrlKey, System::String ^ appSettingBaseUrl);
public void AddServiceDescription (System.Web.Services.Description.ServiceDescription serviceDescription, string appSettingUrlKey, string appSettingBaseUrl);
member this.AddServiceDescription : System.Web.Services.Description.ServiceDescription * string * string -> unit
Public Sub AddServiceDescription (serviceDescription As ServiceDescription, appSettingUrlKey As String, appSettingBaseUrl As String)

參數

serviceDescription
ServiceDescription

要加入至集合的 ServiceDescription 執行個體。

appSettingUrlKey
String

設定 Proxy 類別的 Url 屬性之初始值從 serviceDescription 參數所表示的執行個體來產生。 指定它應該從 web.config 檔的 <appsetting> 區段產生。

appSettingBaseUrl
String

設定 Proxy 類別的 Url 屬性之初始值從 serviceDescription 參數所表示的執行個體來產生。 指定它應該從 WSDL 文件中由 location 屬性指定的這個參數值和 URL 的組合來建構。

範例

下列範例說明 AddServiceDescription 使用 ServiceDescriptionImporter 類別時使用 方法。

// Initialize a service description importer.
ServiceDescriptionImporter^ importer = gcnew ServiceDescriptionImporter;
importer->ProtocolName = "Soap12"; // Use SOAP 1.2.
importer->AddServiceDescription( description, nullptr, nullptr );
// Initialize a service description importer.
ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
importer.ProtocolName = "Soap12";  // Use SOAP 1.2.
importer.AddServiceDescription(description,null,null);

備註

使用這個方法,將實例加入 ServiceDescription 至呼叫 方法時要匯入的 Import 集合。

兩個字串參數 appSettingUrlKeyappSettingBaseUrl 指定如何建構 Url 要從匯 ServiceDescription 入值產生的 XML Web 服務 Proxy 屬性。 參數 appSettingUrlKeyUrl 指定屬性應該使用參數值做為組態索引鍵,從web.config檔案的 <appsettings> 區段讀取。 appSettingUrlKey如果 參數為 null 或空字串,則初始值是由 location Web 服務描述語言 (WSDL) 檔中的屬性所決定。 如果 的值 StyleServer ,如果您嘗試設定 參數的值 appSettingUrlKey ,就會引發錯誤。

參數 appSettingBaseUrl 會指定應該從此參數值與 WSDL 檔案中屬性所 location 指定的 URL 組合來建構屬性的初始值 UrlappSettingUrlKey也必須指定 參數。 屬性 Url 的建構方式是結合從 appSettingBaseUrl 參數建構的相對 URL (,以及從 web.config 檔案載入的 URL) WSDL 指定的 URL。 如果此參數為 null 或空字串,則會從web.config檔案中的值完全建構 URL。

適用於