Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Isapi DLL Azure


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Oct 14, 2015 3:34 AM Last Post By: Bernt Wold
Bernt Wold

Posts: 10
Registered: 9/27/99
Isapi DLL Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 4, 2014 6:58 AM
Anyone out here have experience setting up a ISAPI.dll app to run on Azure ?

I would really like to have a "hello world" dll setup instruction for Azure ..

B

Alexandre Machado

Posts: 1,754
Registered: 8/10/13
Re: Isapi DLL Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 23, 2014 4:27 AM   in response to: Bernt Wold in response to: Bernt Wold
Bernt Wold wrote:
Anyone out here have experience setting up a ISAPI.dll app to run on Azure ?

I would really like to have a "hello world" dll setup instruction for Azure ..

B


Maybe this can get you started?

http://stackoverflow.com/questions/12706109/hosting-an-isapi-dll-and-supporting-files-in-azure

http://stackoverflow.com/questions/10176502/how-can-i-host-a-isapi-extension-on-windows-azure
Abdullah Kauchali

Posts: 28
Registered: 6/30/00
Re: Isapi DLL Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2015 10:58 AM   in response to: Bernt Wold in response to: Bernt Wold
Bernt Wold wrote:
Anyone out here have experience setting up a ISAPI.dll app to run on Azure ?

I would really like to have a "hello world" dll setup instruction for Azure ..

B


Hi Bernt (If you're still lurking after 8 months!) :-)

Here's my experience from the last 24 hours of hacking painfully through Azure documentation for setting up Delphi 32 bit and 64 bit ISAPI dlls. The good news is your ISAPI dll compiled with Delphi is 100% ready for Azure. But some important background for ISAPI configuration and Azure:

1. Azure by default restricts CGI and ISAPI extensions on IIS. This feature is disabled, so your first challenge is to enable it.

2. Azure does not allow some global settings to be changed such as lifting the ISAPI restrictions for all sites. (I may be wrong about this, but 10 hours of hacking and frantic changing and redeploying and being mauled repeatedly by appcmd is the most I am willing to take at my old age now. The good news is that you don't have to waste time with CSPACK and the Azure SDK! This is something we should be grateful about as the documentation from Microsoft leaves much to be desired.)

3. Unlike IIS, Azure enables by default both 32 bit and 64 bit extensions as part of a global application pool setting from which all sites inherit. This is a good thing as conventionally Delphi users would have had to explicitly set the Application Pool to run in 32 bit mode too. Great.

So, here's the solution:

STEP 1:
Create your website on Azure and configure your Deployment user for FTP. All standard stuff.

STEP 2:
Use an FTP client to upload your dlls directly to the wwwroot folder or whatever sub-folder you choose.

(At this stage if you attempt to browse to your dll endpoint, you'll notice that IIS will happily allow your browser to download your dll binaries as if they were just another resource. We want to stop this by letting IIS handle all .dll as ISAPI extensions and load them into IIS's worker threads.)

STEP 3:
Make some global configuration changes that allows ISAPI filters using an XDT file. Simply create a new text file and rename it as "applicationHost.xdt". Put the following xml in the file, save it and transfer the file using FTP to the wwwroot directory alongside web.config.

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<configSections>
    <sectionGroup name="system.webServer">
      <section name="isapiFilters" xdt:Transform="SetAttributes(overrideModeDefault)" overrideModeDefault="Allow" />
    </sectionGroup>
  </configSections>
</configuration>


Notes:

* You cannot make these changes to global settings on Azure with the Portal interface. Also I failed to use Windows instrumentation with appcmd scripts - got turned down by access denied and other errors.

* This configuration only needs to happen once. Unlike the web.config file which needs to be present every time the site is restarted, the xdt file need only be present for the transformation to execute. You can leave it there - don't think it will be dangerous.

STEP 4:
Tell IIS that your site has special dlls that need respect! Create a web.config file that contains the xml below and drop this file into the wwwroot directory of your website:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="true" />
        <handlers accessPolicy="Read, Execute, Script">
            <add name="Any name here" path="*.dll" verb="*" modules="IsapiModule" scriptProcessor="D:\home\site\wwwroot\DELPHI_ISAPI_64.dll" resourceType="File" requireAccess="Execute" preCondition="bitness64" />
			<add name="Another name here" path="*.dll" verb="*" modules="IsapiModule" scriptProcessor="D:\home\site\wwwroot\DELPHI_ISAPI_32.dll" resourceType="File" requireAccess="Execute" preCondition="bitness32" />
        </handlers>
    </system.webServer>
</configuration>


Some points here:

* I have included two <add> nodes for you to see the difference between setting up a handler for a 32 bit and a 64 bit dll. Your site can handle both at the same time. You will have to set one line for each dll you have with the correct 32 bit vs 64 bit preCondition.

* The attribute "preCondition="bitness32" is the crucial part. If this is wrong, you'll get an "Internal Serve Error".

* The "scriptProcessor" attribute was tricky for me. I ended up putting in the full Azure disk path and that seemed to work. If you're not sure what the full disk path for your site is, simply use the "Console" command shell on Azure's new dashboard to find out.

* Your own web.config may contain other settings, simply consolidate them with the above.

* I used the FTP client to upload the web.config directly.

Guess what? That's it!

If anyone else is trying this or has tried this and has succeed differently, please let me know - I am compiling instructions for posterity.

Best of luck

AK

Edited by: Abdullah Kauchali on Mar 17, 2015 11:02 AM
Bernt Wold

Posts: 10
Registered: 9/27/99
Re: Isapi DLL Azure  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2015 2:38 AM   in response to: Abdullah Kauchali in response to: Abdullah Kauchali
Thank you so much for your response.

I have not been using this forum for a while , because it was so buggy. so sorry for late response.

I will test your description :-) , I got it to work myself a while ago by only changing webconfig like below.

<system.webServer>
<handlers accessPolicy="Read, Execute, Script">
<remove name="ISAPI-dll" />
<add name="ISAPI-dll isapitest" path="isapitest32.dll" verb="*" modules="IsapiModule" scriptProcessor="d:\home\site\wwwroot\isapimysql\isapitest32.dll" resourceType="Unspecified" requireAccess="Execute" allowPathInfo="true" />
</handlers>
</system.webServer>


B

Edited by: Bernt Wold on Oct 14, 2015 3:33 AM

Edited by: Bernt Wold on Oct 14, 2015 3:33 AM

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02