Export (0) Print
Expand All

EnabledProtocols Property

IIS 7.0

Gets or sets the protocols that are enabled for the application.

Namespace:  Microsoft.Web.Administration
Assembly:  Microsoft.Web.Administration (in Microsoft.Web.Administration.dll)

public string EnabledProtocols { get; set; }

Property Value

Type: System..::..String
A comma-delimited list of the protocols that are enabled for the application. The default is "http".

This property specifies the protocols that requests can use to access an application. The default value is "http", which enables both the HTTP and HTTPS protocols. A value of "https" also enables both HTTP and HTTPS. If you specify neither "http" nor "https" in the EnabledProtocols property, both HTTP and HTTPS are disabled for your application. If you want to accept only HTTPS requests, configure the Secure Sockets Layer (SSL) feature for your site.

If your site requires additional protocols (such as "NET.TCP") to accept requests, set the EnabledProtocols property by using a comma-delimited list that includes the protocols you need.

Each site can have default protocols configured. If protocols are not explicitly set for the application, EnabledProtocols gets the default protocols that are configured for the site. Use the Site..::..ApplicationDefaults property to view the default settings for a site.

The following example reads the configuration for an existing site. The code displays the value returned from the EnabledProtocols property for the applications configured under the default Web site.

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);
    }
}


...


    }
}


Community Additions

ADD
Show:
© 2015 Microsoft