FTP Site Start Method <Outset>

Overview

The <Start> method of the <ftpServer> element starts the FTP site that <ftpServer> applies to. In one case the <Start> method has been chosen, the run-time country for the FTP site can be determined by the value of the state aspect.

Compatibility

Version Notes
IIS 10.0 The <ftpServer> element was not modified in IIS 10.0.
IIS 8.v The <ftpServer> element that includes the <Start> method was not modified in IIS 8.5.
IIS 8.0 The <ftpServer> element that includes the <Commencement> method was not modified in IIS 8.0.
IIS vii.five The <ftpServer> element that includes the <Start> method shipped as a feature of IIS 7.five.
IIS 7.0 The <ftpServer> element that includes the <Start> method was introduced in FTP 7.0, which was a divide download for IIS 7.0.
IIS half-dozen.0 N/A

Setup

To support FTP publishing for your Web server, y'all must install the FTP service. To do so, employ the following steps.

Windows Server 2012 or Windows Server 2012 R2

  1. On the taskbar, click Server Manager.

  2. In Server Manager, click the Manage carte, then click Add Roles and Features.

  3. In the Add Roles and Features wizard, click Next. Select the installation blazon and click Next. Select the destination server and click Adjacent.

  4. On the Server Roles folio, aggrandize Web Server (IIS), and so select FTP Server.

    Notation

    To back up ASP.Membership authentication or IIS Managing director authentication for the FTP service, you will need to select FTP Extensibility, in addition to FTP Service.
    Screenshot of the F T P Extensibility option being selected and highlighted. .

  5. Click Next, and then on the Select features page, click Next again.

  6. On the Confirm installation selections page, click Install.

  7. On the Results page, click Close.

Windows 8 or Windows viii.ane

  1. On the Commencement screen, move the pointer all the fashion to the lower left corner, correct-click the Offset button, and then click Control Panel.

  2. In Control Panel, click Programs and Features, and and then click Turn Windows features on or off.

  3. Expand Cyberspace Information Services, and and then select FTP Server.

    Note

    To back up ASP.Membership hallmark or IIS Managing director authentication for the FTP service, you will too need to select FTP Extensibility.
    Screenshot of the F T P Extensibility folder being selected and highlighted.

  4. Click OK.

  5. Click Close.

Windows Server 2008 R2

  1. On the taskbar, click Starting time, indicate to Authoritative Tools, and so click Server Manager.

  2. In the Server Director hierarchy pane, expand Roles, and then click Spider web Server (IIS).

  3. In the Web Server (IIS) pane, curlicue to the Part Services section, and so click Add Function Services.

  4. On the Select Role Services folio of the Add Part Services Magician, aggrandize FTP Server.

  5. Select FTP Service.

    Note

    To support ASP.Membership authentication or IIS Director authentication for the FTP service, you volition besides need to select FTP Extensibility.
    Screenshot of the Select Role Services page showing the F T P Service option being highlighted and selected.

  6. Click Side by side.

  7. On the Ostend Installation Selections page, click Install.

  8. On the Results page, click Close.

Windows vii

  1. On the taskbar, click Start, and then click Command Panel.

  2. In Command Panel, click Programs and Features, and so click Turn Windows Features on or off.

  3. Expand Net Information Services, and and then FTP Server.

  4. Select FTP Service.

    Note

    To back up ASP.Membership authentication or IIS Manager authentication for the FTP service, you will likewise need to select FTP Extensibility.
    Screenshot of the F T P Service folder and its sub folders.

  5. Click OK.

Windows Server 2008 or Windows Vista

  1. Download the installation package from the following URL:

    • https://www.iis.net/aggrandize/FTP
  2. Follow the instructions in the post-obit walkthrough to install the FTP service:

    • Installing and Troubleshooting FTP 7

How To

How to kickoff an FTP site

  1. Open up Internet Data Services (IIS) Managing director:

    • If you are using Windows Server 2012 or Windows Server 2012 R2:

      • On the taskbar, click Server Manager, click Tools, and then click Net Information Services (IIS) Manager.
    • If you lot are using Windows 8 or Windows 8.1:

      • Hold down the Windows key, printing the letter X, and then click Command Panel.
      • Click Administrative Tools, and and then double-click Internet Information Services (IIS) Manager.
    • If you are using Windows Server 2008 or Windows Server 2008 R2:

      • On the taskbar, click Beginning, point to Administrative Tools, and and so click Internet Information Services (IIS) Manager.
    • If you are using Windows Vista or Windows vii:

      • On the taskbar, click Start, so click Control Panel.
      • Double-click Administrative Tools, and then double-click Cyberspace Information Services (IIS) Manager.
  2. In the Connections pane, aggrandize the server name, aggrandize the Sites node, so click the proper noun of the FTP site.

  3. In the Manage Website section of the Actions pane, click First.

Configuration

The site-specific <ftpServer> chemical element is configured at the site-level.

Attributes

Non applicative.

Child Elements

Not applicable.

Sample Code

The post-obit examples enable you to start an FTP site programmatically.

C#

              using System; using Organization.Text; using Microsoft.Spider web.Administration;  internal static grade Sample {     private static void Main()     {         using (ServerManager serverManager = new ServerManager())         {             Configuration config = serverManager.GetApplicationHostConfiguration();             // Retrieve the sites collection.             ConfigurationSection sitesSection = config.GetSection("system.applicationHost/sites");             ConfigurationElementCollection sitesCollection = sitesSection.GetCollection();              // Locate a specific site.             ConfigurationElement siteElement = FindElement(sitesCollection, "site", "name", @"mySite");             if (siteElement == null) throw new InvalidOperationException("Chemical element non establish!");              // Create an object for the ftpServer element.             ConfigurationElement ftpServerElement = siteElement.GetChildElement("ftpServer");             // Create an case of the Start method.             ConfigurationMethodInstance Start = ftpServerElement.Methods["Starting time"].CreateInstance();             // Execute the method to start the FTP site.             Commencement.Execute();         }     }    individual static ConfigurationElement FindElement(ConfigurationElementCollection collection, string elementTagName, params string[] keyValues)    {       foreach (ConfigurationElement element in collection)       {          if (String.Equals(element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase))          {             bool matches = true;             for (int i = 0; i < keyValues.Length; i += 2)             {                object o = element.GetAttributeValue(keyValues[i]);                string value = null;                if (o != null)                {                   value = o.ToString();                }                if (!String.Equals(value, keyValues[i + 1], StringComparison.OrdinalIgnoreCase))                {                   matches = false;                   interruption;                }             }             if (matches)             {                render element;             }          }       }       render nil;    } }                          

VB.NET

              Imports System Imports System.Text Imports Microsoft.Web.Administration  Module Sample     Sub Main()         Dim serverManager As ServerManager = New ServerManager         Dim config As Configuration = serverManager.GetApplicationHostConfiguration         ' Retrieve the sites drove.         Dim sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")         Dim sitesCollection Equally ConfigurationElementCollection = sitesSection.GetCollection          ' Locate a specific site.         Dim siteElement As ConfigurationElement = FindElement(sitesCollection, "site", "name", "mySite")         If (siteElement Is Naught) Then             Throw New InvalidOperationException("Chemical element not found!")         End If          ' Create an object for the ftpServer element.         Dim ftpServerElement As ConfigurationElement = siteElement.GetChildElement("ftpServer")         ' Create an example of the FlushLog method.         Dim Start As ConfigurationMethodInstance = ftpServerElement.Methods("Start").CreateInstance()         ' Execute the method to starting time the FTP site.         Start.Execute()      Finish Sub    Private Function FindElement(ByVal drove As ConfigurationElementCollection, ByVal elementTagName As String, ByVal ParamArray keyValues() Equally String) As ConfigurationElement       For Each element As ConfigurationElement In drove          If String.Equals(chemical element.ElementTagName, elementTagName, StringComparison.OrdinalIgnoreCase) Then             Dim matches Every bit Boolean = Truthful             Dim i As Integer             For i = 0 To keyValues.Length - 1 Step 2                Dim o As Object = element.GetAttributeValue(keyValues(i))                Dim value Every bit String = Nothing                If (Not (o) Is Zero) So                   value = o.ToString                Terminate If                If Not String.Equals(value, keyValues((i + 1)), StringComparison.OrdinalIgnoreCase) Then                   matches = Faux                   Exit For                Stop If             Next             If matches Then                Render element             End If          Cease If       Next       Return Nothing    Terminate Office  Stop Module                          

JavaScript

              // Create a Writable Admin Manager object. var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager'); adminManager.CommitPath = "Motorcar/WEBROOT/APPHOST";  // Call back the sites collection. var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites","MACHINE/WEBROOT/APPHOST"); var sitesCollection = sitesSection.Collection;  // Locate a specific site. var siteElementPos = FindElement(sitesCollection,"site",["name","MySite"]); if (siteElementPos == -ane) throw "Element non found!";  // Think the site element. var siteElement = sitesCollection.Item(siteElementPos); // Create an object for the ftpServer element. var ftpServerElement = siteElement.ChildElements.Item("ftpServer"); // Create an instance of the commencement method. var Start = ftpServerElement.Methods.Item("Outset").CreateInstance(); // Execute the method to outset the FTP site. Start.Execute();  function FindElement(drove, elementTagName, valuesToMatch) {    for (var i = 0; i < collection.Count; i++) {       var chemical element = collection.Item(i);       if (chemical element.Name == elementTagName) {          var matches = true;          for (var iVal = 0; iVal < valuesToMatch.length; iVal += 2) {             var property = element.GetPropertyByName(valuesToMatch[iVal]);             var value = holding.Value;             if (value != null) {                value = value.toString();             }             if (value != valuesToMatch[iVal + ane]) {                matches = false;                suspension;             }          }          if (matches) {             return i;          }       }    }    render -i; }                          

VBScript

              ' Create a Writable Admin Director object. Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager") adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"  ' Recall the sites collection. Gear up sitesSection = adminManager.GetAdminSection("organisation.applicationHost/sites","MACHINE/WEBROOT/APPHOST") Set sitesCollection = sitesSection.Collection  ' Locate a specific site. siteElementPos = FindElement(sitesCollection,"site",Array("name","MySite")) If siteElementPos = -1 And then    WScript.Echo "Element not found!"    WScript.Quit Finish If  ' Recollect the site element. Set up siteElement = sitesCollection.Detail(siteElementPos) ' Create an object for the ftpServer element. Set ftpServerElement = siteElement.ChildElements.Item("ftpServer") ' Create an example of the Start method. Set Start = ftpServerElement.Methods.Item("Get-go").CreateInstance() ' Execute the method to start the FTP site. Start.Execute()  Office FindElement(collection, elementTagName, valuesToMatch)    For i = 0 To CInt(collection.Count) - 1       Prepare element = collection.Item(i)       If element.Proper noun = elementTagName Then          matches = Truthful          For iVal = 0 To UBound(valuesToMatch) Step 2             Set property = chemical element.GetPropertyByName(valuesToMatch(iVal))             value = holding.Value             If Non IsNull(value) Then                value = CStr(value)             End If             If Not value = CStr(valuesToMatch(iVal + 1)) And then                matches = False                Exit For             Terminate If          Next          If matches Then             Exit For          Stop If       End If    Adjacent    If matches Then       FindElement = i    Else       FindElement = -ane    Cease If End Function