PDA

View Full Version : Let user select existing IIS website



ricobautsch
10-21-2013, 10:35 AM
I'm trying to write a Setup for our webservice with InstallShield 2013 Pro using a InstallScript MSI Project.
User should be able to select an existing Website in local IIS from a Combobox.
How can i enumerate the existing Websites to show it in a dialogs Combobox.

Thanks in advance for any help.

ricobautsch

ch_eng
10-21-2013, 12:20 PM
ricobautsch,

Flexera has not implemented this yet. One option is to use the DLL (source code available) found in this post:
http://community.flexerasoftware.com/showthread.php?101237

I've asked the Flexera support directly for this feature, and here is the response:

This issue has been submitted to our Engineering team.

Our Engineering team is investigating this issue, but at this moment, there is no estimated time frame for when it will be addressed.
You can track the status of this issue by checking product release notes or searching our Knowledge Base through eService.

HTH

ricobautsch
10-22-2013, 07:17 AM
Thanks for your reply.
I followed your suggestion and tried to implement something with the help of this dll.
But sadly, i have no success so far.
With the following code i end up with my szReturn message = "Object not created",
CoGetObject seems to fail.
Do you have any suggestions?



function STRING ForEachNextExample()
STRING szReturn;
VARIANT __varEnumHolder; //Hold IEnumVariant during the ForEachLoop, don't use OBJECT type, this is an IUnknown!!
OBJECT oIIS;
OBJECT oSite;
begin
szReturn = "";

if (UseDLL(SUPPORTDIR ^ "IsGetObj.dll") < 0) then
szReturn = "DLL not loaded";
endif;

set oIIS = CoGetObject("IIS://localhost/W3WSVC", "");
if (!IsObject(oIIS)) then
szReturn = "Object not created.";
endif;

ForEachStart(oIIS, __varEnumHolder);
while(ERROR_SUCCESS == ForEachGetNextItem(__varEnumHolder, oSite))
szReturn = szReturn + "site: " + oSite.class;
szReturn = szReturn + "\n";
endwhile;

set __varEnumHolder = NOTHING;
UnUseDLL("IsGetObj.dll");

szReturn = szReturn + "Ready";
return szReturn;
end;

ricobautsch
10-22-2013, 07:33 AM
sorry for my last post, this was my fault, there was simply a fault in "IIS://localhost/W3WSVC" (one W to much).

But, if i have the list of Websites, how do i have to configure the "Internet Information Services" view to install the application to this selected WebSite?
Simply setting the Name field is wrong, as i see.
Do i have to get the port of the selected site and set it to the configuration via a Property?
Is this the right way?

ch_eng
10-22-2013, 08:45 AM
ricobautsch,

Yes - you will need 3 MSI properties in order to be able to dynamically install your web application on a user-specified website:
Name
TCP Port Number
Site Number

Optionally, you may need a property for Application Pool unless you hardcode that.

Off topic: I would recommend, however, that if you use Dynamic File Links for the files in your website component you may want to consider using an InstallScript Only project. I've had to convert 3 Website installers from InstallScript MSI to InstallScript Only due to how each type handles Dynamic File Links.

HTH

ricobautsch
10-23-2013, 10:34 AM
thanx for your help.
I was able to build a setup where user can select the website in a custom dialog.
I don't use dynamic file links. My Website component is empty, because i created a component for each file, according to best practices.

A small problem persists.
I would like to remember the selected Website name in registry, so user gets it as suggestion the next time he installs an update.
I created a property and used a "System Search" which stores my registry value to this property.
After the custom Dialog i call MsiSetProperty to set the new value to this property.
And finally i created a component where i set the value of this property to the registry.

For Initial Setup this is fine, the registry value is written, and the next Setup reads it correct to do a suggestion.
But the new value is never written to the registry. The existing registry item keeps untouched.
The "never overwrite" is set to "No" in this component.

Do you have any idea why the existring registry will never be modified?

ch_eng
10-23-2013, 10:50 AM
ricobautsch,

Glad you got the user-selected website part working. As for registry keys, I've had hit or miss experience with that. You may just want to add a RegDBSetKeyValueEx call at the end of your update to manually (re)write whatever the value is.

HTH

ricobautsch
10-24-2013, 03:34 AM
Now i also solved my problem with the registry value which was never modified.
I simply used another property for the "System Search" than for the component.

* "System Search" to get registry value to my property OLD_INSTALLED_WEBSITE
* use this value in the custom dialog where user can select from existing Websites
* set user selected value to new property INSTALLED_WEBSITE, this will be used in the component

I have no idea why, but this way it works as expected.

Thank you again for your help.

azhockeynut
02-10-2014, 04:30 PM
Now i also solved my problem with the registry value which was never modified.
I simply used another property for the "System Search" than for the component.

* "System Search" to get registry value to my property OLD_INSTALLED_WEBSITE
* use this value in the custom dialog where user can select from existing Websites
* set user selected value to new property INSTALLED_WEBSITE, this will be used in the component

I have no idea why, but this way it works as expected.

Thank you again for your help.



I sent you a private message, but no idea if you monitor those.
I would LOVE to see how you accomplished this. It seems common sense that IS would actually have a standard feature to do this (enumerate IIS sites, select an existing, add new, etc.) I simply cannot believe they do not offer it as a standard function.

Please share the details so the rest of us noobs can get this done. Thanks