h.k.foysol
Posts: 17
Joined: Thu Oct 13, 2016 10:34 am
Contact: Skype

Deploying New WebSite In IIS

I think this must have been answered somewhere. But I was not able to find it my self. I need to deploy my website in IIS by creating a new website. I need to take the information required from the user to create the website. I was able to figure out most of it but got stuck how I can set "All Unassigned" or IP address and some permission settings.

I should allow the user to provide the following
1. Name of the website
2. Host Name
3. TCP Port
4. SSL Port
5. IP Address / All Unassigned
6. Access Checkboxes like (Read, Write, Directory Browsing etc)

I am having difficulties figuring out
- How to set IP Address or All Unassigned.
- How to set Read, Write and Directory browsing permission

Help is appreciated and thanks in advance.
Humayun Kabir Foysol
Team Lead
Enosis Solutions
http://www.enosisbd.com
h.k.foysol
Posts: 17
Joined: Thu Oct 13, 2016 10:34 am
Contact: Skype

Re: Deploying New WebSite In IIS

Any suggestion guys? Desperately need this.
Humayun Kabir Foysol
Team Lead
Enosis Solutions
http://www.enosisbd.com
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Deploying New WebSite In IIS

Hello,

Setting the website's "Access Flags" can be done using "Custom Properties" from "IIS" page. The permission flags can be managed using a list of checkboxes on a dialog. The checkboxes state can be set to an IIS attribute called "accessPolicy" from the "system.webServer/handlers" section. The flag "Enable Directory Browsing" option is treated separately, using the "enabled" attribute from "system.webServer/directoryBrowse" section.

The "accessPolicy" attribute must have the following format :

Code: Select all

flags (None, Read, Write, Execute, Source, Script, NoRemoteWrite, NoRemoteRead, NoRemoteExecute, NoRemoteScript)
Each flag value can be collected from the UI by adding on a dialog a checkbox for each one of the above flags (i.e. Read, Write, Execute, etc). To compute the entire “accessPolicy” attribute value you can set an installer property (i.e. ACCESS_FLAGS_VALUES) with the values of the above checkbox properties.

The "enabled" attribute must be set to “True” or “False” and this can be done by using a checkbox (e. g. “UA_EDBROWSING”) on a dialog. When the checkbox is checked we will set a property (i.e. “BROWSING”) to “True”, otherwise to “False”.

In order to set the flags, you can make the following configuration :
1. In a dialog page create checkboxes for all the permissions you allow the user to set at install time.
2. In each checkbox “Properties” page, the "Value" must be the corresponding flag name followed by "," (e.g. "NoRemoteWrite,"). This is necessary because after setting the checkboxes, when you "compose" the "ACCESS_FLAGS_VALUES" property to set the "accessPolicy" attribute value, the members must be separated by ",".
3. The “ACCESS_FLAGS_VALUES” property will be set to the above checkbox property values. This means it will be either <empty> or it will be set to a string ending with comma character. So, you must trim the comma from the end of the "ACCESS_FLAGS_VALUES" or – in case the property is empty – set its value to "None". In the attached example we used a Run Powershell inline script custom action to do the trim or set the property to "None".

Code: Select all

$A_F_Value = AI_GetMsiProperty ACCESS_FLAGS_VALUES
IF ($A_F_Value -ne "") 
{$A_F_Value = $A_F_Value.TrimEnd(",")} 
ELSE 
{$A_F_Value = "None"}
AI_SetMsiProperty ACCESS_FLAGS_VALUES $A_F_Value
4. In the IIS page, select the website, navigate to Custom Properties tab in the right pane and add two atribute values: "enabled" attribute from "system.webServer/directoryBrowse" section and "accessPolicy" attribute from "system.webServer/handlers" section:

Section : system.webServer/directoryBrowse
Name : enabled
Type : boolean (True/False)
Value : [BROWSING] – the property set depending on the "Enable Directory Browsing" checkbox state

Section : system.webServer/handlers
Name : accessPolicy
Type : flags (None, Read, Write, Execute, Source, Script, NoRemoteWrite, NoRemoteRead, NoRemoteExecute, NoRemoteScript)
Value : [ACCESS_FLAGS_VALUES]

Regarding the other problem, to set an IP address or check the "All unassigned" checkbox in the binding section based on user dialog input, you can create three edit boxes – "HOSTNAME", "TCP_PORT" and "IP_ADDRESS", populated from the dialog page. On the same page, you create a checkbox with the property "UNASSIGNED", corresponding to the "All unassigned" option. On the "Next" button of this dialog you should create a published control event – "Set installer property value" which will set the "IP_ADDRESS" property to the <empty> value if "UNASSIGNED" checkbox is checked.
In the "IIS" page, select the website, navigate to "Bindings/SSL" section in the right pane and add a "New HTTP Binding", as follows :

Hostname: [HOSTNAME]
Port Number: [TCP_PORT]
IP Address: [IP_ADDRESS]

If the "IP_ADDRESS" will be empty, the "All unassigned" option will be automatically set at install time by Advanced Installer.

Please find attached a sample project which implements these settings.
IIS User Input.aip
(30.3 KiB) Downloaded 364 times
If you have any questions or doubts just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
h.k.foysol
Posts: 17
Joined: Thu Oct 13, 2016 10:34 am
Contact: Skype

Re: Deploying New WebSite In IIS

Daniel,

Can't thank you enough man. This works like a charm. Thank you.

I am waiting for two other reply. Hope you can help me

http://www.advancedinstaller.com/forums ... 759#p90759
and
http://www.advancedinstaller.com/forums ... 742#p90742
Humayun Kabir Foysol
Team Lead
Enosis Solutions
http://www.enosisbd.com
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Deploying New WebSite In IIS

You're welcome.

We'll also post a reply on the other threads you opened as soon as we have a solution.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”