Created On:  03 March 2011

Problem:

When calling an unmanaged COBOL .dll from an ASP.NET Web Service or Web Site application an HTML error 500 is returned from the call.

Resolution:

ASP.NET runs under control of a Web Server, either IIS or a local file system Web Server available in Visual Studio. This Web Server is actually run as a Windows Service.

In order for a call to an unmanaged COBOL .dll to be able to resolve the location of the .dll it is necessary to add the location of the .dll to the systems PATH environment variable.

Example:

If your web site and your unmanaged COBOL .dll are in the following folder:
      C:\inetpub\wwwroot\mysite

Then you need to modify the PATH to include this using Control Panel->System->Advanced Settings->Environment Variables:
Change PATH to include C:\inetpub\wwwroot\mysite.

Because the Web Server is running as a Windows Service you will need to reboot the computer before the change will be picked up by your web site. Reboot and the call to unmanaged code should now work correctly.
Incident #2505608