问题
what are minimal steps required to make ISAPI dll working in IIS7 for query www.website.com/test/bin/ISAPIGet.dll?a=b ? Please don't refer to top google searches, they are very generic and don't work. I wrote very simple ISAPIGet.dll in Delphi2010, which works great in IIS5 Win2000. Then I put it on IIS7 SBS2008, into C:\inetpub\wwwroot\website\test\bin folder. Created website for /website, Application for /test, VirtualDirectory for /bin, in HandlerMappings for /bin Added Script Map *.dll to my ISAPIGet.dll, allowed my dll in ISAPIandCgiRestrictions, created 32bit ApplicationPool NonManaged code, Classic mode, bound it to /test Application. When quering www.website.com/test/bin/ISAPIGet.dll?a=b I'm getting all kinds of errors like 500, 503 (when AppPool fails), while homepage www.website.com is working fine. What else should I do? Do I need to configure web.config file, where and how?
回答1:
As I recall, I had similar problems getting our ISAPI DLL to run in IIS7 on WinSvr2008R2(64b). I wrote down some quick notes to help me repeat the steps that finally got it working. I'll try to provide those here (at least what we did).
- Grant "Read & Execute, List folder contents, and Read" rights to IUSR to the folder
C:\PathToISAPI_DLL
- Copy all DLL files that the ISAPI DLL needs to run into the
c:\windows\syswow64
folder (e.g., midas.dll, dbxmss.dll, etc.) - Start IIS Manager
- Add the app pool "MyAppPool" [no managed, classic, start now]
- Change "Advanced Settings" of new App Pool to allow 32-bit, plus set idle time-out
- Add an application "MyApp" to your website using "MyAppPool" and set the physical path to
C:\PathToISAPI_DLL
Now you have to do several steps at the DOS prompt to finish configuring things:
cd /d c:\windows\system32\inetsrv
REM *** Grant rights to execute the DLL ***
appcmd.exe set config -section:isapiCgiRestriction /+[path='C:\PathToISAPI_DLL\ISAPI.dll',allowed='true']
REM *** Grant the url of the Execute access for hander mappings ***
appcmd.exe set config "Default Web Site/MyApp/ISAPI.DLL" "/commit:Default Web Site/MyApp" /section:handlers /accessPolicy:Read,Script,Execute
REM *** Make sure you have an ISAPI module mapping for *.dll at that path ***
appcmd.exe list config "Default Web Site/MyApp" /section:handlers | findstr /i *.dll
That's the extent of my notes. I have successfully followed them several times and it has always worked. I have never been able to get it work using just the GUI. I've always had to run the appcmd
commands at a DOS prompt to finish configuring things.
Sometimes I still see a 404 error, in which case I delete the web.config from the folder with the ISAPI.DLL and run the last two appcmd
commands again. Of course, my ISAPI DLL doesn't have any other settings in the web.config file so it doesn't hurt to just delete it...
回答2:
Is it not just because the dll is 32 bit and IIS7 is a 64 bit process so is not able to read a Delphi 32 bit dll?
Your main page is static html which is handled by IIS with no problem.
But when IIS tries to load ISAPIGet.dll
, it fails because it is not a 64 bit library, or one of its dependency is missing.
- Are you sure you use a IIS7 app-pool in 32-bit mode?
- Do you have all needed sub-libraries and bpl in the same path or in c:\windows\syswow64 ?
来源:https://stackoverflow.com/questions/15261808/how-to-configure-delphi-2010-isapi-dll-in-iis7-64bit