How to install a CGI/ISAPI application in IIS ? - Advanced Installer Community
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

How to install a CGI/ISAPI application in IIS ?

Hello,

I can't find how I am supposed to have AI properly install CGI and ISAPI applications in IIS.

Normally, I would need to:
- Make sure CGI/ISAPI is enabled on the web server
- Enable ISAPI/CGI in the "Module mapping" of the web site
- Add an entry in the server's "ISAPI and CGI restrictions" for the application executable file or libraries and enable it.

The first item, I can do but none of the others.

Any suggestion on how to tackle this ?
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to install a CGI/ISAPI application in IIS ?

Hello,
- Make sure CGI/ISAPI is enabled on the web server
I assume you are using Windows Features for this.
- Enable ISAPI/CGI in the "Module mapping" of the web site
In the Custom Properties tab of the Web Site you can add a custom property, something like that:
  • Section field: system.webServer/handlers
  • Name:accessPolicy
  • Value: Read, Execute, Script
Add an entry in the server's "ISAPI restrictions" for the application executable file or libraries and enable it.
In the ISAPI Filters tab of your web site you can configure the ISAPI filter and its corresponding restriction.
- Add an entry in the server's "CGI restrictions" for the application executable file or libraries and enable it.
In order to add the CGI restriction, you can go in the Custom Actions page and add the predefined Launch file custom action with sequence.
Edit its properties like that:
  • File to Launch field: [SystemFolder]inetsrv\appcmd.exe
    Command Line field: set config -section:system.webServer/security/isapiCgiRestriction /+"[\[]path='[PathToYourCGI_Script]l',description=' TestRule',allowed='True'[\]]"
Make sure you set this custom action as a deferred one and it is only executed during Install Execution Stage Condition. Also, you need to uncheck the Fail installation if custom action returns an error Execution Option because it the related CGI restriction is already defined, the custom action will fail.

Please let us know if that helped.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: How to install a CGI/ISAPI application in IIS ?

Hello,

Thanks for your answer.

What you suggested works with the exception of the module handler mapping. The CGI/ISAPI handlers already exists (and trying to overwrite them is a mistake that can render the web server unusable after uninstall).

What is required is for the feature permissions of ISAPI/CGI to be changed from read/script to read/script/execute.

As for ISAPI restrictions, I'm afraid you've misunderstood: I'm not installing an ISAPI filter, I'm installing an ISAPI extension (i.e. it will only handle requests made directly to it, not every call). The call you suggested for CGI, however, works fine with ISAPI too.
Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Re: How to install a CGI/ISAPI application in IIS ?

I found a solution for setting the CGI/ISAPI execute access policy as well. It's another custom action (similar to the ones you linked)

file

Code: Select all

[SystemFolder]inetsrv\appcmd.exe
parameters:

Code: Select all

set config -section:"system.webServer/handlers" -accessPolicy:"Read,Script,Execute"
That will enable CGI/ISAPI on the whole web server but that's good enough for me.

Thank you for your help
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: How to install a CGI/ISAPI application in IIS ?

You're welcome,

Please note that there is no need for the custom action in order to Enable ISAPI/CGI in the "Module mapping" of the web site.

As I said in my previos reply, in order to Enable ISAPI/CGI in the "Module mapping" of the web site you can follow these steps:
In the Custom Properties tab of the Web Site you can add a custom property, something like that:
  • Section field: system.webServer/handlers
  • Name:accessPolicy
  • Value: Read, Execute, Script
Have you tried to do this and didn't worked as expected?

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”