Before you can configure your .NET COBOL application, ensure that:
If your application also uses native code components, you need to setup the licensing and create some shared folders - see To run a native COBOL application from a network server.
When running a .NET COBOL application from a network server, you need to ensure the appropriate .NET run-time assemblies are available to the application.
The mechanism for locating and loading .NET assemblies at run-time is different to the one used for native .dlls. Native applications use the PATH system environment variable to locate dependent assemblies. For .NET COBOL applications, the required COBOL run-time assemblies must be in the same folder that contains your application files in order for the application to locate them. To ensure this:
For example, share \redist\v4.0 if you copied the application to it. If your application targets .NET Framework v2.0, then share the \redist\v2.0 folder.
This approach is not applicable to the scenario where your application uses the standard COBOL CALL mechanism to load the dependent assemblies - for example: set <procedure-pointer> to entry "progname" or call "progname". Programs loaded in this way are located using the PATH environment variable. To make deployment easier, Micro Focus recommends that you keep all dependent .NET assemblies within the same folder.
If you are setting the PATH environment variable to locate any called assemblies in this case, Micro Focus recommends you set the variable directly in your app.config file and not at system level. For example, your app.config file should look like this:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <!--The following code declares a section group for application configuration --> <sectionGroup name="MicroFocus.COBOL.Application"> <section name="Switches" type="System.Configuration.NameValueSectionHandler" /> <section name="Environment" type="System.Configuration.NameValueSectionHandler" /> </sectionGroup> <!--The following code declares a section group for run-time configuration --> <sectionGroup name="MicroFocus.COBOL.Runtime"> <section name="Tunables" type="System.Configuration.NameValueSectionHandler" /> <section name="Switches" type="System.Configuration.NameValueSectionHandler" /> </sectionGroup> </configSections> <MicroFocus.COBOL.Application> <Switches /> <Environment> <add key="PATH" value="F:\myappfiles;%PATH%" /> </Environment> </MicroFocus.COBOL.Application> </configuration>
By default, network drives only have "local intranet" permissions which restricts a lot of the operations you might want to do on them. This is why, when running a .NET COBOL application from a network share, you need to elevate its security level. You can do this in one of the following ways:
<runtime> <loadFromRemoteSources enabled="true"/> </runtime>
For example:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <!--The following code declares a section group for application configuration --> <sectionGroup name="MicroFocus.COBOL.Application"> <section name="Switches" type="System.Configuration.NameValueSectionHandler" /> <section name="Environment" type="System.Configuration.NameValueSectionHandler" /> </sectionGroup> <!--The following code declares a section group for run-time configuration --> <sectionGroup name="MicroFocus.COBOL.Runtime"> <section name="Tunables" type="System.Configuration.NameValueSectionHandler" /> <section name="Switches" type="System.Configuration.NameValueSectionHandler" /> </sectionGroup> </configSections> <runtime> <!--The following line provides Full Trust for assemblies loaded from a network share --> <loadFromRemoteSources enabled="true"/> </runtime> </configuration>