Created On:  29 March 2012

Problem:

I have developed an ASP.NET Web Site using Visual COBOL running locally on my development computer. I now wish to deploy it under IIS on a production machine on which Visual COBOL is not installed. How do I do this?

Resolution:

The following are instructions on how to deploy a Visual COBOL ASP.NET web site onto a production server running Windows 7 and IIS 7.

This includes web sites that call native .dlls that are using the ACU/RM file handler:


Deploying COBOL ASP.NET Web Services and Web Sites developed with Visual COBOL under IIS

Because the COBOL 2010 Runtime product does not include the COBOL compiler the following steps must be used when deploying the web site to a Production server.

In this example the web site is in folder C:\testwebsite and the name of the web site is also testwebsite.

1. On the target computer, install the COBOL 2010 Runtime product.

2. Open the Micro Focus License Manager and install the authorization code for the COBOL 2010 Runtime product.

3. If you are using any native COBOL .dlls in your web site ensure that they are being linked with the dynamic option by checking the Properties-]COBOL Link tab for the native projects. If they are linked as shared then you will have to add the COBOL 2010 Runtime\bin folder to the PATH on the target computer.

4. Precompile the web site:
On the development computer open the web site in the Visual Studio IDE and select Build->Publish Web site from the IDE menu.
Select a location to place the precompiled site such as C:\PrecompiledWeb\testwebsite and click OK to publish the site.

5. Copy the subfolder containing the precompiled web site to your target computer.
In this example, I copied the testwebsite subfolder of C:\PrecompiledWeb to the production computer as C:\testwebsite.

6. On the target computer start Windows Explorer and navigate to the C:\testwebsite folder, right click on your files with the .aspx extension (Web Page) and select edit.

You will see something similar to the following line:
[%@ page language="COBOL" autoeventwireup="true" inherits="_Default, App_Web_zcawdwq5" %]

Remove the Language="COBOL" option so it looks like:

[%@ page autoeventwireup="true" inherits="_Default, App_Web_zcawdwq5" %]

and Save it.

Do this for each of your web pages.

7. Right click on web.config in the same folder and select Edit.

You will see the following section:
[system.web]
[compilation batch="false" debug="true" targetFramework="4.0"/]
[/system.web]

Change the debug="true" option to "false" and remove the targetFramework so that it looks like:
[system.web]
[compilation batch="false" debug="false" /]
[/system.web]

In the same file you will see the following section:

[system.codedom]
[compilers]
[compiler language="COBOL" extension=".cbl" compilerOptions="sourceformat(variable) warnings(2)" type="MicroFocus.COBOL.CodeDom.COBOLCodeProvider, MicroFocus.COBOL.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0412c5e0b2aaa8f0"/]
[/compilers]
[/system.codedom]

comment this section out by adding the following two comment lines:
[!--
[system.codedom]
[compilers]
[compiler language="COBOL" extension=".cbl" compilerOptions="sourceformat(variable) warnings(2)" type="MicroFocus.COBOL.CodeDom.COBOLCodeProvider, MicroFocus.COBOL.CodeDom, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0412c5e0b2aaa8f0"/]
[/compilers]
[/system.codedom]
--]

Save the changes and exit.

8. If you have any native .dlls that the application is calling you need to add their location to the system PATH environment variable.
You should copy the native .dlls into the bin folder of the web site, in this example c:\testwebsite\bin and then add this folder to
the PATH using Control Panel--]System--]Advanced--]Environment variables.
If you are using any other environment variables such as A_CONFIG or COBCONFIG you should also set them to point to the location of their relevant files.

9. After making these changes reboot the target computer.

10. When the system restarts, open up IIS Manager under Administrative Tools.
Navigate under Connections to the branch for Default Web Site and Right click and select Add Virtual Directory.
Alias should contain the name of your web site and Physical Path should be the top level folder, e.g. C:\testwebsite.
Save this.

11. In IIS, right click on your new Alias and select Convert to Application. Click OK.

12. If you are deploying your ASP.NET Web Site or Web Service to a 64-bit OS then you have the option of doing the following:

- In IIS Manager click on the branch for Application Pools.
- In the list of Application Pools select DefaultAppPool and under Actions select Advanced Settings.
- Set the option Enable 32-Bit Applications to True.
- Ensure that the setting for .NET Framework version set to the coirrect version that you are running most likely 4.0.
- Click OK to save.

Test the web site by starting Internet Explorer and entering http://localhost/testwebsite

Your Web Service or Web Site should now run correctly.