FoxPro and .NET Interop
Try to call and host FoxPro Web Services through .NET
Gravatar is a globally recognized avatar based on your email address. Try to call and host FoxPro Web Services through .NET
  Luis Guerra
  All
  Feb 23, 2021 @ 03:30pm

I created a small web service using a VFP9 .dll and taking and fixing the sample code of this article to my needs (using VS2019). It worked well on my development environment but when I copy all the solution's binaries and files to the web server together with the VFP9 .dll (and registering it) and re-init IIS.

I register the ws url on VFP's toolbox, and then I drag the ws url from the toolbox to an empty .prg it generates code so that VFP can use the ws. But when I try to call any function of the web service, it shows me the following error message:

When I saw that message I tried to call the VFP .dll directly (no web service) with a small vfp .exe and it works like a charm! So, what's wrong with the werb service that it doesn't recognized the .dll registered?

Thanks in advance.

Gravatar is a globally recognized avatar based on your email address. re: Try to call and host FoxPro Web Services through .NET
  Rick Strahl
  Luis Guerra
  Feb 23, 2021 @ 04:53pm

Permissions most likely. Make sure you use an account in the Application Pool that rights to access the registry. Specifically make sure you don't use the ApplicationPoolUser account - it doesn't have access to the registry to read COM registrations.

Try using System or Network service, and then dial back security to fit your environment.

Make sure you can call the COM component without running it in the Web Service on the Web Server. You can use Powershell to instantiate the service and call a method (or do whatever the code does) as described here (for Web Connection but same idea):

Testing your COM Server in Windows

+++ Rick --

Gravatar is a globally recognized avatar based on your email address. re: Try to call and host FoxPro Web Services through .NET
  Luis Guerra
  Rick Strahl
  Feb 24, 2021 @ 09:07am

I followed your advice. Did the following, changed the account as you suggested:

Then I changed security on the .dll like this:

But I still keep getting the same error message. Am I doing something wrong? Or is there anything else to do?

Gravatar is a globally recognized avatar based on your email address. re: Try to call and host FoxPro Web Services through .NET
  Rick Strahl
  Luis Guerra
  Feb 24, 2021 @ 01:00pm

Start with SYSTEM to make sure the COM op isn't a security issue. Network service might still require special permissions.

If that's not it, then the issue isn't the permissions, but that's almost always the place to start.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Try to call and host FoxPro Web Services through .NET
  Luis Guerra
  Rick Strahl
  Feb 24, 2021 @ 02:20pm

Hi Rick. Thanks for your great help. I changed the account to SYSTEM. It still didn't have effect, I mean, it showed me the same error message.

But, navigating through the options in IIS I saw the "Enable 32-bit applications" option which had a value of FALSE. I changed it to TRUE, like this:

Then clicked on "OK", then restarted IIS. Finally I could run the web services functions without any problem!

Gravatar is a globally recognized avatar based on your email address. re: Try to call and host FoxPro Web Services through .NET
  Rick Strahl
  Luis Guerra
  Feb 24, 2021 @ 02:33pm

Yeah, that's required to run FoxPro COM objects which are 32 bit... easy to forget. It's a big note item in the Web COnnection docs, but Web Connection setup auto-configures that switch. Actually Web Connection can run in 64 bit IIS mode as servers are out of proc, and the Web Connection module can run in 64 bit mode.

IAC, for configuration issues always start at the Application Pool level and go through the options there.

+++ Rick ---

© 1996-2024