问题
I have an installer I am modifying where we are modifying a web site in IIS. The requirements state that the end user must create the site first in IIS. We read the site information they choose from a dropdown in the installer for their site, and store the information in properties in WiX.
I have a WebSite element under a component, and have the ConfigureIfExists set to yes. A lot of this seems to be working great, it resets the directory of the site to where the website is on the drive.
The problem is that when I check the set up in IIS, the web site is not started, even when I have AutoStart = yes and StartOnInstall = yes. The problem I am seeing is that, since it is an existing web site, it creates a duplicate binding for the site, same port and everything, which is causing the site not to run.
Does anyone know why this is happening, or how to resolve it? I need it to not duplicate the binding so that the web site can be restarted when installation is complete.
回答1:
I advise you to try this scenario with WiX v3.6 (take the latest available build). There were lots of fixes in IIS7 extension, and it's very likely your problem will just go away.
EDIT: now WiX 3.6 is in official beta. It is quite stable and contains lots of fixes to IIS extension.
回答2:
I had a similar problem. I was able to work around it with the following method, but be advised, it is kind of a hack.
For my existing website, I match it on SiteId and set whatever configuration properties I want to change with the WebDirProperties attribute. Then, in the iis:WebAddress element, I set the Port number to some unused port (I used 8081). This will add an extra http binding in IIS7 (as you saw in your question). Then, I create a custom action that I run before InstallFinalize. The custom action basically loops through the site Bindings, looks for the one that matches the bogus port that I entered in wix and deletes it. Then the custom action starts the website and everything is good.
This was the only way I could find to get it to work in Wix 3.5. It is not the best method, but it worked for me.
来源:https://stackoverflow.com/questions/6831603/wix-website-creates-second-duplicate-binding-when-configureifexists-set-to-yes