Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appcmd.exe to overwrite a single site's entire xml config (applying the settings to a site that already exists)

I don't want to delete and recreate a site I just want to be able to apply the entire config to it and override any settings that are different.

I backed up the site config with %windir%\system32\inetsrv\appcmd list site /config /xml > c:\sites.xml

This command throws an error:

appcmd.exe add site /in < c:\sites.xml
ERROR ( message:Failed to add duplicate collection element "mysite". )

Do I really have to break out ALL of my IIS configuration into separate appcmd commands or is there a way to apply the entire xml in one shot and only have it override settings?

I want to have a single xml template that I can push out to all my webservers hosting this site.

like image 615
red888 Avatar asked Oct 29 '25 08:10

red888


1 Answers

If you already exists installed sites then you must by have other ID for new site

<SITE SITE.NAME="NewSite" SITE.ID="1094096085" bindings="*" state="Started">

        <site name="NewSite" id="1094096085" serverAutoStart="false">

Else you get conflict by ID

like image 153
Алексей Коробов Avatar answered Oct 31 '25 11:10

Алексей Коробов