cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
LoupiNet
Level 3

Cannot add an application mapping (ISAPI) in IIS7

Hello,

I developed a basic MSI project that installs a Web Site on port 80.
It adds a custom application pool, then create two virtual directories
that use this application pool. For each of these virtual directories,
i must add an "application mapping" to the php isapi dll that i installed with the project too.

It works great with IIS 6.0, but with Win7 & IIS 7.0, the installation rollbacks!

InstallShield 16:27:50: AddElement failed with the following HRESULT: '-2147024863':
InstallShield 16:27:50: Error in setting the AppMaps of smartprofile_admin
InstallShield 16:27:50: Error with IISRT: -2147024863. Error translation: The process cannot access the file because another process has locked a portion of the file.
CustomAction ISIISInstall returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Fin de l'action 16:27:50 : InstallFinalize. Valeur renvoyée : 3.
Action 16:27:50 : Rollback.


Is this happening because the installer im using also installed the isapi filter and has not finished yet???

Regards

Louis-Pierre Beaumont
Labels (1)
0 Kudos
(1) Reply
LoupiNet
Level 3

Finally, i found why!

By default, IIS 7.0 has security restrictions for application mappings.
A new web.config cannot override the handlers is these restrictions are enabled.

To disable them, i added a custom action before installing the web site.
This custom action calls appcmd.exe with these parameters:

appcmd.exe unlock config /section:system.webServer/handlers

Also, IIS 7 has a list of ISAPI dlls that are allowed/denied to load.
To allow an ISAPI dll to be loaded, another custom action must be added:

inetsrv\appcmd.exe set config /section:isapiCgiRestriction /+"[\[]path='MyIsapiDllPath.dll',description='MY ISAPI',allowed='True'[\]]"

And finally, there is another problem: when InstallShield adds the new application mapping to the list of handlers, it is added at the last position of the list. By default there is a filter that handles *.*, so the new filter wont work!
To remedy that, a final custom action must be added:

appcmd.exe set config /section:handlers /+"[\[]name='MY ISAPI',path='*.myextension',verb='GET,HEAD,POST',modules='IsapiModule',scriptProcessor=''MyIsapiDllPath.dll',resourceType='File'[\]]"

All these custom actions require administrator rights. To make sure they work, you must Advertise if prerequisites are elevated.

I hope this post will help others that have the same problem. In the future, it would be great to add an equivalent fix in InstallShield 2010 sp2.

Have a nice day!

Louis-Pierre Beaumont
0 Kudos