Calling AppServer from a Windows Service

BellTower

New Member
I have a Windows Service (written in VB.NET) that monitors a message queue and uses the data in the messages it receives to make calls to an AppServer proxy. Everytime I try to create an instance of the proxy inside the service, it blows up with a "ClassFactory cannot supply requested class" error. This occurs regardless of whether the service is running under my domain account or under LocalSystem. When running the same code in a test application, I can create the proxy fine and retrieve the data without any problem.

The code that blows up looks like this:

"appSrvProxy = New jaccessLib.Cjaccess"

I've been trying to figure out how to make the proxy work inside the service for more than a day. If anyone out there has any words of wisdom, I would greatly appreciate you sharing them.
 

bulklodd

Member
"appSrvProxy = New jaccessLib.Cjaccess"

Maybe I misunderstand something, but this code is not enogh to make connection to AppServer. You should have an instance of the connection class, then pass it to your proxy object, I suppose it should look like this:

conn = new Connection(ConnectString,"","","")
appSrvProxy = New jaccessLib.Cjaccess(conn)

If it's so maybe the cause in connection parameters which can be meaningless when your program starts as a service.
BTW It would be useful to cite all error message and to specify your progress version also. Anyway look at PKB solutions #P2484 and #P19430.
 

BellTower

New Member
The error message is:

System.Runtime.InteropServices.COMException (0x80040111): ClassFactory cannot supply requested class

followed by the stack trace.

All the code that I've seen for creating the proxy that talks to AppServer looks like this:

appSrvProxy = New jaccessLib.Cjaccess
appSrvProxy.OC_Connect(appSrvConnStr, String.Empty, String.Empty, String.Empty)

This code works in a test application but the first line does nothing but explode in a spectacular fashion inside of a Windows Service for reasons I don't understand.

Also, I've tried creating a VB6 dll to wrap the AppServer proxy I'm using just to see if that level of indirection helps any. All I got in that case was this error:

System.Runtime.InteropServices.COMException (0x800A01AD): ActiveX component can't create object

I'm still stumped but I'll take a look at those PKB solutions you mentioned and see if they help any. I've been pulled off onto another project though so it may be a little while before I get around to it. Thanks.
 

bulklodd

Member
Anyway I have no idea about your PROGRESS version therefore I don't see any reason to discuss right way to talk to AppServer. BTW I suppose you have 9.1x version, don't you? If it's so look at this solution:

ID: P19430
Title: "Using Open Client ActiveX proxy with a .Net application generates error 0x80040111"
Created: 02/14/2003Last Modified: 07/30/2004Status: Verified
WME('Facts: ');

Facts:
Progress 9.x
WME('Symptoms: ');

Symptoms:
Using Open Client ActiveX proxy with a .Net applicationWME('Symptoms: ');
Application gets runtime exceptionWME('Symptoms: ');
System.Runtime.InteropServices.COMException (0x80040111): ClassFactory cannot supply requested class
WME('Cause: ');

Cause:
When the ActiveX proxy is registered the threading model is set to "Both"WME('Fixes: ');

Fixes:
Modify the 'ThreadingModel' key for your proxy in the registry and change the value from 'Both' to 'Apartment'. The proxy can be found in the registry by searching for the name of the proxy including the .DLL extension.

There're other solutions in PKB: #p2484, #p91525 and #p9397.
 

BellTower

New Member
As a quick test I tried changing the threading model and I started getting different errors from further into the process. I think that this means the problem is fixed and I'm finally getting to the processing of the data and I have errors to deal with there. I'll do some more extensive tests when I have more time later but for now it appears that I've gotten past my main problem.

Thanks for the help Bulklodd! I appreciate it and so does my keyboard indented forehead. :biggrin:
 
Top