IIS 7.0 and FTP 7

Discussion in 'ASP .Net' started by Mick Walker, Oct 30, 2007.

  1. Mick Walker

    Mick Walker Guest

    I am using a combination of IIS 7.0 and Microsoft FTP Publishing Service
    7.0 RC0 on my system.

    I am looking for a way to automate the deployment of ftp servers the way
    I also automate the deployment of new websites within IIS.

    I have looked at my applicationHost.config file, and noticed that the
    FTP server makes the following changes to the file:

    <binding protocol="ftp" bindingInformation="*:21:" />
    serverCertHash="AEAFAC5AAE6A0D057B552BF2065957718BCB50BB" ssl128="false"
    controlChannelPolicy="SslAllow" dataChannelPolicy="SslAllow" />
    <basicAuthentication enabled="true" />
    <messages exitMessage="Goodbye"
    greetingMessage="Welcome" bannerMessage="Hello" maxClientsMessage="Max
    Connections" suppressDefaultBanner="true" />
    <userIsolation mode="None">
    <activeDirectory />

    Under the current <site> node.

    It also adds the following upon adding ftp support to the first site:

    FOr each website that ftp support is added to, it writes the following
    information in the same file:

    <location path="ControlPanel">
    <add accessType="Allow" users="mick.walker"
    permissions="Read, Write" />
    <location path="Default Web Site">
    <add accessType="Allow" users="mick.walker"
    permissions="Read, Write" />

    I am looking for a way to do this manually. I would love to find an API
    to do it for me, but if not I would have to write the raw XML to the
    file myself. I have never used XML before, so does anyone have a few
    buzz words I should read into to figure out what it is I need to do?

    Or if anyone knows a better way, please suggest it. :)

    (ASP.NET is running with appropriate permissions to modify the file)
    Mick Walker, Oct 30, 2007
    1. Advertisements

  2. Mick Walker

    Ken Schaefer Guest

    Some options to look at:

    Use WMI
    Use appcmd.exe

    Ken Schaefer, Oct 30, 2007
    1. Advertisements

  3. Mick Walker

    Mick Walker Guest

    Thanks for your reply Ken, I have actually been looking at

    I wrote a little test program, which would allow me to modify various
    options within the appplicationHost.config file:

    using System;
    using Microsoft.Web.Administration;

    namespace WebATest1 {
    internal class Program {
    private static void Main(string[] args) {
    ServerManager serverManager =
    Configuration config =

    // This works Perfectly
    ConfigurationSection section =
    ConfigurationElement element =

    Console.Write("allowSessionState attribute value: ");

    Console.WriteLine("Set allowSessionState value to true");

    element.SetAttributeValue("allowSessionState", true);


    Console.Write("allowSessionState attribute value: ");


    section = null;
    element = null;

    // However this part doesnt
    section = config.GetSection("system.webServer/");
    element = section.GetChildElement("enableKernelCache");

    Console.Write("enableKernelCache enabled value: ");

    Console.WriteLine("Set enabled value to false ");
    element.SetAttributeValue("enableKernelCache", false);


    The first part works perfectly, however the second part of the program

    the applicationHost.config file section in question looks like:

    diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled
    Templates" />
    <session allowSessionState="true" />

    <caching enabled="true" enableKernelCache="true">

    <cgi />

    Also I can not find any information on adding elements using the above
    Mick Walker, Oct 30, 2007
  4. Mick Walker

    Ken Schaefer Guest

    I am not so familiar with using managed code, but I'll try to repro your

    When you say "it doesn't work", what do you mean exactly? nothing changes?
    you get an error? etc


    Ken Schaefer, Oct 31, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.