Highlighted
Absent Member.
Absent Member.
1859 views

[archive] How to execute 8.1 runtime with .NET interop from a shared drive

[Migrated content. Thread originally posted on 30 June 2009]

Hi all,

I want to share with you some useful information about how execute a COBOL app that interoperates with .NET with 8.1 runtime.

As this is a common setup for most of our customer, this can be of interest to many of you.

We begin from the deployment of the VC CRT and VC MFC as shared assemblies
(this should be common yet), note the 2 folders Microsoft.VC80.CRT and Microsoft.VC80.MFC.
Then to interoperate with .NET we need also AcuToNet.dll and Marshal.exe.

AcuToNet.dll is a .NET assembly that need to be registered for COM interoperability
by the RegAsm.exe utility (that is present in the .Net Framework installation
directory).
The problem is that you can't normally register an assembly on a network
share that is not strong typed. So we need to alter the system privileges
with CASPOL.EXE (that one comes in .NET Framework too), trusting only AcuToNet.DLL.
After you have executed CASPOL.EXE, you can finally register AcuToNet.dll
and Marshal.exe (the latter is needed to pass the data back from .NET to
COBOL).

Here you can see the full session:

Z:\ldevoti\public\studioFarma\bin>dir
Il volume nell'unit? Z ? Data1
Numero di serie del volume: D863-CFC9

Directory di Z:\ldevoti\public\studioFarma\bin

25/06/2009 11.00 .
25/06/2009 11.00 ..
28/11/2008 19.35 147.456 aclnt.dll
28/11/2008 19.35 339.968 acme.dll
25/06/2009 10.57 28.672 AcuToNet.dll
22/09/2008 10.36 225.280 ajpg32.dll
28/11/2008 19.35 884.736 atermmgr.dll
28/11/2008 19.36 245.760 avision5.dll
28/11/2008 19.36 81.920 axml32.dll
28/11/2008 19.35 196.608 libexpat.dll
22/09/2008 12.30 94.208 Marshal.exe
20/05/2009 11.23 Microsoft.VC80.CRT
20/05/2009 11.23 Microsoft.VC80.MFC
20/04/2009 09.11 16.384 myHMACSHA1.dll
23/09/2005 07.28 53.248 RegAsm20Acu.exe
20/04/2009 09.12 20.480 WindowsApplication1.exe
18/01/2008 17.39 429 wrun32.3lc
28/11/2008 19.46 1.482.752 wrun32.dll
28/11/2008 19.36 122.880 wrun32.exe
28/11/2008 19.34 73.728 zlib.dll
16 File 4.047.277 byte
4 Directory 37.721.026.560 byte disponibili

Z:\ldevoti\public\studioFarma\bin>c:\windows\Microsoft.NET\Framework\v2.0.50727\caspol
-m -ag 1.2 -url file://z:\ldevoti\public\studioFarma\bin\AcuToNet.dll FullTrust
Microsoft (R) .NET Framework CasPol 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.

The operation you are performing will alter security policy.
Are you sure you want to perform this operation? (yes/no)
y
Added union code group with "-url" membership condition to the Machine level.
Success

Z:\ldevoti\public\studioFarma\bin>c:\windows\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe
/tlb /codebase AcuToNet.dll
Microsoft (R) .NET Framework Assembly Registration Utility 2.0.50727.42
Copyright (C) Microsoft Corporation 1998-2004. All rights reserved.

Types registered successfully
Assembly exported to 'Z:\ldevoti\public\studioFarma\bin\AcuToNet.tlb', and
the type library was registered successfully

Z:\ldevoti\public\studioFarma\bin>Marshal.exe /RegServer

Z:\ldevoti\public\studioFarma\bin>cd ..

Z:\ldevoti\public\studioFarma>lancia

Z:\ldevoti\public\studioFarma>.\bin\wrun32.exe -c c -d program1

Hope this is useful
best regards,
Luca Devoti
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] How to execute 8.1 runtime with .NET interop from a shared drive

This is all well and done.
No problems using ?myown.dll? (a .NET-dll) with the ?.NET-bridge?(acutonet.dll) when calling it from my program on a shared drive.
BUT when I try it with ThinClient I get the ?CoCreate Instance?-error.
So everything is located on the server (program, dll?s and data), all registration(regasm/caspol/..etc) is done on the server.
Do I need to do something on the Client to get this going?
(?Myown.dll? does not have any screen output, and I don?t have any other problems with the ThinClient except when the program is calling this dll?).
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] How to execute 8.1 runtime with .NET interop from a shared drive

If you want to have the dot net module running on the client, the client will need all the set up as if it was on the server. This include setting up the '.NET-bridge".

I suspect the error is coming from the thin client trying to invoke the acutonet.dll.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] How to execute 8.1 runtime with .NET interop from a shared drive

No, I don't want the net module running on the client. I want it to run on the server together with all the other programs. I can't see why it's not working, that's why I wonder if I have to do something on client side too?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] How to execute 8.1 runtime with .NET interop from a shared drive

Can you reprodude this with a small example program that you can post here?
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.