IIS Settings - Advanced Installer Community
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

IIS Settings

Hello!

My scenario:
I have 32bit files and 64bit files divided up into 32bit features (only included in my 32bit build) and 64bit features (only included in my 64bit build). This is also true for my IIS website files. This means I need to create two websites (32bit and 64bit) and two application pools (32bit and 64bit) in the IIS view. I set the “Install Condition” field for the websites and application pools so that the correct website and application pool is installed (ex: if it’s a 32bit build, the 32bit website/app pool is installed).
Image
This seems to work for everything, except when I add a “FastCgiModule” mapping to both the 32bit and 64bit websites (only showing 32bit below):
Image

Doing this adds these files to the Global Settings under “FastCGI Settings”:
Image

The issue here is, these FastCgi Settings are no longer conditional. Meaning, both “phpcgi.exe” and “phpcgi.exe_1” will try to be added to IIS, but only one will exist during runtime (either the 32bit one or the 64bit). This causes the installer to fail. I’m guessing this issue will occur to any setting that is added under the “Global Settings”.

So, to work around this, I decided to try and make these settings using “Custom Properties”, since I think these settings will remain conditional (based on the install condition of the website). The problem here is, I cannot get the “isapiCgiRestriction” and “fastCgi” settings to work:
Image

These two settings cause a failure during the IIS configuration part of the install. The “handlers” setting seems to work fine. The only difference I see, is “isapiCgiRestriction” and “fastCgi” are not shown in the AI ui:
Image

So, I’m not sure if AI supports these two custom properties? But, if I manually type in “system.webServer/security/isapiCgiRestriction”, AI seems to detect the collection just fine.

Any suggestions on how I should handle this scenario?


Also, I noticed the following:
Image

This is what my “ISAPI and CGI Restrictions” setting looks like after installation. Notice the “|” symbol at the end of the first entry (which is a “FastCgiModule”). For some reason, AI is appending the pipe symbol to the end of the path. Not sure if this is expected (as a delimiter or something), or if it’s a bug. This occurs when using the built in AI IIS settings (i.e., not using “Custom Properties”).


Thanks.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: IIS Settings

Hello,
The issue here is, these FastCgi Settings are no longer conditional. Meaning, both “phpcgi.exe” and “phpcgi.exe_1” will try to be added to IIS, but only one will exist during runtime (either the 32bit one or the 64bit). This causes the installer to fail. I’m guessing this issue will occur to any setting that is added under the “Global Settings”.
Indeed, this is an Advanced Installer issue. A fix will be available in a future version of Advanced Installer, thank you for bringing it to our attention. We will notify you as soon as the fix is out.

Until then, as a workaround you should try to use your own custom action to add the application mappings for your web sites.
So, I’m not sure if AI supports these two custom properties? But, if I manually type in “system.webServer/security/isapiCgiRestriction”, AI seems to detect the collection just fine.

Any suggestions on how I should handle this scenario?
I'm afraid the "isapiCgiRestriction" and "fastCgi" properties are available to be set only for the entire IIS server, they cannot be set for a specific web site. Therefore, you cannot use the "Custom Properties" tab of your web site to set them. The workaround would be for you to create your own custom action.
This is what my “ISAPI and CGI Restrictions” setting looks like after installation. Notice the “|” symbol at the end of the first entry (which is a “FastCgiModule”). For some reason, AI is appending the pipe symbol to the end of the path. Not sure if this is expected (as a delimiter or something), or if it’s a bug. This occurs when using the built in AI IIS settings (i.e., not using “Custom Properties”).
This is as expected being a valid syntax, the pipe character is a separator between the EXE and its arguments (in your case no arguments are configured for the "php-cgi.exe").

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: IIS Settings

Thank you for answering all of my questions!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: IIS Settings

You're welcome.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: IIS Settings

After some testing, I have a couple followup questions.

I want to make the following IIS changes using a custom action:
  • Add php-cgi.exe to "FastCGI Settings" (Global setting)
  • Add php-cgi.exe to "ISAPI and CGI Restrictions" (Global setting).
  • Add "*.php" handler mapping to "Handler Mappings" (Local to my application/website)
The issues:
  • Where is the best location for my custom action? It's not quite clear to me how/when the IIS settings are made. It appears IIS settings are not made by any MSI standard action, but rather, some behind-the-scenes AI custom action? It appears this AI custom action occurs during or after "InstallFinalize"? Currently, I put my custom action between "InstallExecute" and "InstallFinalize".
  • Should the custom action be "deferred" or "commit"? The issue here is, if I make the custom action "deferred", then I cannot make any IIS setting changes to my local application/website, since it won't yet exist (until after AI makes sets up my application/website, which seems to be during "InstallFinalize"). So, if I want to make IIS setting changes to a local application (that is set up in AI), I have to make the custom action commit? After testing this, it seems to work. But, maybe there are consequences to making this custom action "commit"?
If the "commit" custom action solution isn't recommended, I can think of two workarounds:
  • Include "web.config" with my installation, and make all local application/website settings in this file. The global IIS setting changes would stay in my "deferred" custom action. Perhaps this would also allow me to carry over custom IIS settings during an upgrade, by merging the XML changes in web.config.
  • Add the handler mapping in AI, then edit the AI project file to remove the FastCGI setting (which is the setting that started all of this). AI would create the handler mapping and ISAPI/CGI restriction. The global "FastCGI" setting would stay in my "deferred" custom action.
Any advice would be greatly appreciated.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: IIS Settings

Hello,

There is nothing wrong by setting your custom action to run on commit stage. However, if you still want to run the custom action on deferred stage, then you can proceed like this:
1. go to "Custom Actions" page and add your custom action as deferred after "Install Execution Stage -> Add Resources" action group
2. go to "Table Editor" page and select the "InstallExecuteSequence" table
3. edit the "Sequence" column of your action row to have a greater value (6550) than our "AI_IIsInstall" custom action
4. rebuild and test the installation setup

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: IIS Settings

Hello,

Our development team already added a fix for this issue and it will be included in our next version of Advanced Installer. We will notify you when this fix will be officially out. In the meantime, if you are interested in testing the fix we have added just send us an email to support at advancedinstaller dot com mentioning the AI version you are currently using and we'll get back to you with a fixed version of our IIS module.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: IIS Settings

Hello,

This was fixed in version 12.3 of Advanced Installer released on July 16th, 2015.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
codesynergy
Posts: 100
Joined: Fri Nov 14, 2014 10:29 pm

Re: IIS Settings

Thanks for fixing this! It seems to be working exactly as I had hoped.

Return to “Common Problems”