共用方式為


Application.EnabledProtocols 屬性

定義

取得或設定為應用程式啟用的通訊協定。

public:
 property System::String ^ EnabledProtocols { System::String ^ get(); void set(System::String ^ value); };
public string EnabledProtocols { get; set; }
member this.EnabledProtocols : string with get, set
Public Property EnabledProtocols As String

屬性值

為應用程式啟用之通訊協定的逗號分隔清單。 預設值為 「HTTP」。

範例

下列範例會讀取現有月臺的組態。 程式碼會顯示從 EnabledProtocols 預設網站下設定之應用程式之 屬性傳回的值。

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Web.Administration;
using Microsoft.Web.Management;

namespace AdministrationSnippets
{
    public class AdministrationApplicationEnabledProtocols
    {
// Writes out the applications and the protocols enabled for 
// each application under the default Web site.
public void GetEnabledProtocols()
{
    ServerManager manager = new ServerManager();
    Site defaultSite = manager.Sites["Default Web Site"];

    foreach (Application app in defaultSite.Applications)
    {
        Console.WriteLine(
            "{0} has enabled the following protocols: '{1}'", 
            app.Path, app.EnabledProtocols);
    }
}
    }
}

備註

此屬性會指定要求可用來存取應用程式的通訊協定。 預設值為 「HTTP」,可同時啟用 HTTP 和 HTTPS 通訊協定。 「HTTPs」 的值也會同時啟用 HTTP 和 HTTPS。 如果您在 屬性中 EnabledProtocols 未指定 「HTTP」 或 「HTTPs」,則會停用應用程式的 HTTP 和 HTTPS。 如果您想要只接受 HTTPS 要求,請為您的網站設定安全通訊端層 (SSL) 功能。

如果您的月臺需要其他通訊協定, (例如 「NET」。TCP「) 接受要求,請使用包含所需通訊協定的逗號分隔清單來設定 EnabledProtocols 屬性。

每個月臺都可以設定預設通訊協定。 如果未明確設定應用程式的通訊協定, EnabledProtocols 請取得為月臺設定的預設通訊協定。 Microsoft.Web.Administration.Site.ApplicationDefaults使用 屬性來檢視網站的預設設定。

適用於