views:

587

answers:

1

I created a very simple Delphi 2010 CGI web service and am able to get the exact same problem on Delphi 2007.

My invokable interface looks like this:

ISimpleTest = interface(IInvokable)
['{4E318A9A-D361-4A18-A963-EE6D7F70E9C5}']
  function SayHello(const S: string; N: Integer): string; stdcall;
end;

And the function is implemented in a similarly simple fashion:

function TSimpleTest.SayHello(const S: string; N: Integer): string;
begin
  Result := 'Hello ' + S + ', all ' + IntToStr(N) + ' of you';
end;

I copied the resulting SimplecGI.exe to our Windows Server 2008 server running IIS7. I created my virtual folder, configured execute permissions, allowed unspecified CGI modules, enabled 32 bit applications and was then finally able to see the service info page from my browser using a URL like this one: http://myserver:8001/SimpleCGI/SimpleCGI.exe

The configuration steps are different from IIS6 but the service info page looks identical on both IIS versions. It also has links for the WSDL for ISimpleTest, just like it did on IIS6. But on IIS6, clicking this link (a url like this: http://myserver/SimpleCGI/SimpleCGI.exe/wsdl/ISimpleTest) shows the expected WSDL in the browser. In IIS7 though, clicking this same link just shows the service info page again. The same goes for the WSDL link for IWSDLPublish and the WSIL link (http://myserver:8001/SimpleCGI/SimpleCGI.exe/inspection.wsil).

Anyone seen this before? Anyone solved it before?

+1  A: 

OK, found the answer here: http://forums.iis.net/p/1100323/1745984.aspx

The default security settings on IIS7 remove the path info from the URL for CGI apps. To circumvent it (and allow the web service to work), add the following to a web.config file in the same folder as your executable:

<configuration>
  <system.webServer>
    <handlers>
      <add name="ScriptMap1" path="SimpleCGI.exe" verb="*" modules="CgiModule" scriptProcessor="E:\Mypath\SimpleCGI.exe" resourceType="File" allowPathInfo="true" />
    </handlers>
  </system.webServer>
</configuration>
Cobus Kruger