Friday, May 4, 2012

Wix: where is my web application created?

Installing a web application, I want to select on wich web site it suppose to be created.
So, I let's say I have 2 web sites:

Default Web Site listening on *:80
Test Web Site listening on *:8080

In my wix code I write smth like that:

<iis:WebSite Id='SelectedWebSite'
      <iis:WebAddress Id="AllUnassigned" Port="80"/>

AND I put this under Product, since I am not interested in my web site being created on install and removed on uninstall, i.e. I ask user to choose from existing web sites (details see here:

So far so good. Moving on - to virtual dir and web application itself.
Under dedicated component  write this:
 <iis:WebVirtualDir Id="VDir"
           <iis:WebApplication Id="MyWebAppApplication"
                                             Name="[WEB_APP_NAME]" />
           <iis:WebDirProperties Id="SelectedWebSite_Properties"
                                                DefaultDocuments="Default.aspx" />
So I start installation and select Test Web Site to install under. What do I expect? Virtual directory and web application being created under selected web site.
But hold on, it is not that easy!

In that case, virtual directory is located under the right place, but web application ended up under Default Web Site. Why is that? Becouse it is Default Web Site listening to *:80, and that(*:80) is specified in iis:WebAddress part under iis:WebSite.
Just to make sure, I changed  to <iis:WebAddress Id="AllUnassigned" Port="8080"/> - and vuala, this time my web application ended up under correct Test Web Site.


No comments:

Post a Comment