0

I've got two sample VFP9 OlePublic dlls that I'm calling from a .NET Core 2.1 project running full framework .NET 4.6.1. Everything is working fine locally but upon deployment to a Windows Server 2016 machine, I'm only able to instantiate an instance of a.dll or b.dll, not both. It seems the last one to be registered wins.

If I register a.dll then b.ll, I can instantiate an instance of b & vice versa.

Retrieving the COM class factory for component with CLSID {CF0998BA-54F1-40BD-BB92-4E938A77E1E5} failed due to the following error: 80004005 Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)).

Define Class miked As Session OLEPUBLIC
    
FUNCTION HelloWorld as String
    RETURN "Hello World"
ENDFUNC 

FUNCTION Echo(thingToEcho as String) as String
    RETURN thingToEcho
ENDFUNC 

Enddefine 
public void TestMikeDll()
{
    new miked.miked();
}

I'm guessing I haven't configured/defined something correctly in my VPF9 projects?


publish profile:

screenshot of publish profile


update

So it's not the last one registered, it's the first one to get instantiated. If I successfully instantiate a.dll then b.dll fails but if I recyle the app pool & try b.dll first it succeeds & a.dll fails.

spottedmahn
  • 14,823
  • 13
  • 108
  • 178
  • Have you tried building in X86? – Vivek Nuna Oct 23 '22 at 14:54
  • yes, the project is set to `x86` and deployment as well; question updated. @viveknuna – spottedmahn Oct 23 '22 at 15:00
  • 1
    the 5 of the error code is the Win32 error code which means access denied. I would run procmon and watch for registry/file accesses which fail. That should hint to the right direction what went wrong. – Alois Kraus Oct 23 '22 at 15:12
  • thanks @AloisKraus, that did the trick!! how did you know the `5` means access denied? – spottedmahn Oct 23 '22 at 16:12
  • 1
    It does not mean "access denied". E_FAIL is a teacher's grade for the quality of the error reporting. – Hans Passant Oct 23 '22 at 16:29
  • 1
    @spottedmahn: Hans is right, that E_FAIL is 0x80004005L, but E_ACCESSDENIED is defined slightly different as 0x80070005L. Still whenever I see a 5 at the end (at least for memory dumps where it is access denied, but that is another error code) the chances are high that somewhere something else did go wrong due to access issues. – Alois Kraus Oct 24 '22 at 07:15

1 Answers1

0

Give the AppPool identity write (maybe modify too) access to the location of the VFP COM Dlls. Apparently, it needs to dynamically create another DLL: [original name]r1.dll that has a file desc of "Microsoft Visual FoxPro 9.0 SP2 Runtime Library" (the purple box).

change permissions screenshot

  1. Go to properties on folder where COM DLLs live
  2. Security Tab
  3. Edit
  4. Add
  5. in enter the object names to select: IIS AppPool\[your AppPool name]

reference: MSFT doc page on giving AppPool identity file permissions


credit: this comment from Aloio Kraus lead me down the path:

the 5 of the error code is the Win32 error code which means access denied. I would run procmon and watch for registry/file accesses which fail. That should hint to the right direction what went wrong

enter image description here

spottedmahn
  • 14,823
  • 13
  • 108
  • 178
  • I **think** my real problem was [my install not finding some runtime DLLs](https://stackoverflow.com/a/74186260/185123) – spottedmahn Oct 28 '22 at 13:44