Choose website - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Choose website

During the install, is it possible to interactively define a new website or choose a particular website?

Some customers require to install the application to the default website, where as other choose to install to a new website on a specific port that they define. When I used the Wise installer (for all its sins!) it was able to choose or define new website, and if defining a new website we had the ability to specify the port and other logging options, etc
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Choose website

Hello,

The website name supports properties. For example, input [WEBSITENAME] into the website's name field. The website will have the name contained in the WEBSITENAME property. You can choose whether to install a file or not by using the Install Condition field.

Use the Dialog Editor to add controls to your dialogs so the user can decide whether or not to install to the default website, and if not, give a name to the new website.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

Is there a simple way to choose the website from a list of already available ones, I saw an example project that enumerated all websites and virtual directories, is that the approach I need to use?

giving a name to the website isnt really what I want to do, its more I want the person doing the install be able to choose which website it will go onto and then the installer to put the virtual directories defined in the IIS setup part onto the selected website
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Choose website

Hi,

The following forum post discusses a similar situation, it should help you accomplish the desired actions.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

Wow!

I never saw that small icon hidden away on the toolbar, guess I was expecting it in the left hand panel

Thanks Bogdan, thats exactly the kind of thing I was looking for

one final question, if I wanted to get the website starting point from what was selected on the dialog (i.e. http://localhost:81) for substituting into my web.config XML files, how would I get that?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Choose website

Hi,
if I wanted to get the website starting point from what was selected on the dialog (i.e. http://localhost:81) for substituting into my web.config XML files, how would I get that?
This is very easy, first you need to go to Files and Folders page and import the "web.config" file as a standard XML file. Then double click it, our XML editor will open.

Now you can search for the XML entry you want to store the value desired and use the public property from the MSI dialog, "MY_WEBSITE_NAME", to set the content of the XML file like this:

Code: Select all

value="[MY_WEBSITE_NAME]"

The property will expand its value at run-time, just as you wish to.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

Okay thanks Bogdan

I've come across another issue, when the user selects the non-default website, running on another port, how can i tell the iis part of the setup to install to that rather than the default.
The referenced forum post shows using IIS_SELECTED<> "Default Web Site", but this seems to refer to either installing on the default or creating a new website, I cant quite see how I can tell the IIS to put the virtual dirs onto the selected website from the dialog [MY_WEBSITE_NAME] maybe?

If i create a duplcate of my vdirs like in your linked forum post, using the IIS_SELECTED condition, what do I need to set on the website in IIS dialog to get it to use the selected website from the dialog box?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Choose website

Hi,

You can try to set the "Error policy" group of this web site in Advanced Installer to "Skip item installation".

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

Yes i figured that Bogdan, but if my non-default-website is setup under the IIS tab in AI, its already got a bound port, my question was more, how do I change this website to match the settings returned from the dialog box?

is there inbuild properties I can use, or should I use MY_WEBSITE_NAME somewhere in the AI IIS setup?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Choose website

Hi,

The web site from the IIS page in Advanced Installer can be configured at run-time only by using public properties. Like you did for the site name you can do for the port number or IP address.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

I think i'm just about there! i'm saving off the [IISBrowseComboBox] to IIS_SELECTED using a custom action on the "Next" button, then I use that variable as the website name on the "new" website in AI IIS, so now it gets installed to the correct website.

The definition of that website is running on localhost:8081, and this is what I need to substitute into the web.config, but this isnt what the IISBrowseComboxBox is putting into the IIS_SELECTED variable
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Choose website

Hi,

I understand, so what you want to do is to obtain the web site bindings of the site selected and store them in the web.config file.

For this you can use the same wizard, when you configure it on one of the dialogs there is combo which will allow you to select "web site bindings". This is the data that will be retrieved
from the site when it is selected.

This information will be stored in a new property, called "IISBrowseSelectedValue", and will be available after you press the [Next] button on the dialog in which you select the web site.
You can read more in the following article.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

Unfortunately that doesn't give me what I need

Binding path is returning ":8081:" and that extra : at the end means I cant use this...
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Choose website

Hi,

This is the standard method used to return the bindings of the web site. In your case it simply returns the web site port because it has no host name.

If the site would have a hostname you would get something like this:

Code: Select all

:8081:My_Host_Name
The next step is to use a custom action to parse this string and get from it only the parts you are interested in. The following article is on another topic but it contains a script sample that shows how you can parse a property, in this case "CustomActionData", in your case you will use the property "IISBrowseSelectedValue".

After you get the values desired from the property IISBrowseSelectedValue you can place them in new public properties that will be added in the XML file.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
FergusMurray
Posts: 150
Joined: Thu Sep 30, 2010 10:44 am

Re: Choose website

Yes, ended up being relatively simple, heres the script I used in case anyone else needs

Function getWebsiteRootFromBindings()
Dim tokens
Dim file
file=Session.Property("IISBrowseSelectedValue")
tokens=Split(file,":")
if tokens(1)<>"80" Then
Session.Property("IISSelectedWebroot")="127.0.0.1:"+tokens(1)
else
Session.Property("IISSelectedWebroot")="127.0.0.1"
end if
End Function

Return to “Common Problems”