locked
Configuring defaultDocument property via appcmd RRS feed

  • Question

  • User1415704676 posted
    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...
    Tuesday, January 12, 2010 2:31 PM

Answers

  • User1973541685 posted

    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.

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, January 12, 2010 3:54 PM

All replies

  • User1973541685 posted

    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.

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, January 12, 2010 3:54 PM
  • User1415704676 posted
    Wow... Thank you very much. After adding double quotes around whole parameter /files problem is solved.
    Tuesday, January 12, 2010 4:01 PM
  • User455390698 posted

    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)

    Monday, August 8, 2011 11:11 AM