Configuring defaultDocument property via appcmd [Answered]RSS

3 replies

Last post Aug 08, 2011 11:11 AM by pachyderm5

  • Configuring defaultDocument property via appcmd

    Jan 12, 2010 02:31 PM|v.svidersky|LINK

    I'm stuck with very simple task. I'm trying to add default document from CLI interface. Using appcmd for that. Already did apppool, vdir, app creation using appcmd - worked fine. But this one doesn't want to wok despite many tries...

    appcmd.exe set config "Default Web Site/MySite" /section:defaultDocument /+files.[@start,value='index.html'] /commit:"Default Web Site"

    This one gives me back: Failed to process input: The parameter 'value=index.html]' must begin with a / or - (HRESULT=80070057).

    I've read that @start is actually optional, but if I try without it, like:

    appcmd.exe set config "Default Web Site/MySite" /section:defaultDocument /+files.[value='index.html'] /commit:"Default Web Site"

    I get: ERROR ( message:Malformed collection indexer; format is [@position,name='value',name2='value2',...]. The @position spec ifier is optional, and be '@start', '@end', or '@N' where N is a numeric index into the collection. )

    Any help will be much appreciated...

    appcmd IIS7 configuration

  • Re: Configuring defaultDocument property via appcmd

    Jan 12, 2010 03:54 PM|Jamescoo|LINK

    Can you try putting double quotes around /+files like this:

    appcmd.exe set config "Default Web Site/MySite" /section:defaultDocument "/+files.[@start,value='index.html']" /commit:"Default Web Site"

    Just trying to understand the error as I'm not getting it myself.

     

  • Re: Configuring defaultDocument property via appcmd

    Jan 12, 2010 04:01 PM|v.svidersky|LINK

    Wow... Thank you very much. After adding double quotes around whole parameter /files problem is solved.
  • Re: Configuring defaultDocument property via appcmd

    Aug 08, 2011 11:11 AM|pachyderm5|LINK

    escaping the [...] collection element with "" worked for me too - probably just one of those shell things (that's what I'd say on Unix, anyway)