single com server instance 
Author Message
 single com server instance

Hello everybody,
I've some trouble with a com server. To try to limit and reproduce the
problem I've done the following little sample:
1) I create an exe com server (apartment threaded) under my winnt4.0 sp5
workstation
2) Into this server I put a single object (also apartment threaded) with a
single method that do nothing (just return S_OK)
3) in the _tWinMain code, after the _Module.RegisterClassObjects(..) but
before the message spooling loop, I've inserted a Sleep(30000) to have a
server very slow during startup (this was because in the real problem my
initialization procedure is very slow).
4) Compiled and builded.

If I try to call the method of the com object in the server from a client
(win32 console application) written in vc++, and, during 30 seconds, also
from an ASP page (that run under IIS4.0), I end up with two distinct exe
server loaded in memory (I see them with. Task Manager).

What I'm trying to do is to have ONLY ONE com server responding to the two
requests. Is it possible?

Thankyou in advance

Loris



Sat, 26 Jun 2004 00:57:44 GMT  
 single com server instance
Give some code.


Quote:
> Hello everybody,
> I've some trouble with a com server. To try to limit and reproduce the
> problem I've done the following little sample:
> 1) I create an exe com server (apartment threaded) under my winnt4.0 sp5
> workstation
> 2) Into this server I put a single object (also apartment threaded) with a
> single method that do nothing (just return S_OK)
> 3) in the _tWinMain code, after the _Module.RegisterClassObjects(..) but
> before the message spooling loop, I've inserted a Sleep(30000) to have a
> server very slow during startup (this was because in the real problem my
> initialization procedure is very slow).
> 4) Compiled and builded.

> If I try to call the method of the com object in the server from a client
> (win32 console application) written in vc++, and, during 30 seconds, also
> from an ASP page (that run under IIS4.0), I end up with two distinct exe
> server loaded in memory (I see them with. Task Manager).

> What I'm trying to do is to have ONLY ONE com server responding to the two
> requests. Is it possible?

> Thankyou in advance

> Loris



Sat, 26 Jun 2004 07:34:08 GMT  
 single com server instance
If you want to make your EXE com server single instance use:

const CATID CATID_SafeForScripting     =
 {0x7dd95801,0x9882,0x11cf,{0x9f,0xa9,0x00,0xaa,0x00,0x6c,0x42,0xc4}};
const CATID CATID_SafeForInitializing  =
 {0x7dd95802,0x9882,0x11cf,{0x9f,0xa9,0x00,0xaa,0x00,0x6c,0x42,0xc4}};

//TypeLib {E9A259A2-B896-461b-A013-0DA621BA1C9F}
/*DEFINE_GUID(_tlid, 0xE9A259A2, 0xB896, 0x461b, 0xA0, 0x13,
   0x0D, 0xA6, 0x21, 0xBA, 0x1C, 0x9F);*/

////////////////////////////////////////////////////////////////////////////
/
// CpsSub
class ATL_NO_VTABLE CpsSub :
 public CComObjectRootEx<CComSingleThreadModel>,
 public CComCoClass<CpsSub, &CLSID_psSub>,
 public IDispatchImpl<IpsSub, &IID_IpsSub, &LIBID_PSCTLLib>
{
public:
 DECLARE_CLASSFACTORY_SINGLETON(CpsSub)

//2001.12.07 - 2?2?3?
BEGIN_CATEGORY_MAP(CpsSub)
 IMPLEMENTED_CATEGORY(CATID_SafeForInitializing)
 IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
END_CATEGORY_MAP()

.....


Quote:
> Hello everybody,
> I've some trouble with a com server. To try to limit and reproduce the
> problem I've done the following little sample:
> 1) I create an exe com server (apartment threaded) under my winnt4.0 sp5
> workstation
> 2) Into this server I put a single object (also apartment threaded) with a
> single method that do nothing (just return S_OK)
> 3) in the _tWinMain code, after the _Module.RegisterClassObjects(..) but
> before the message spooling loop, I've inserted a Sleep(30000) to have a
> server very slow during startup (this was because in the real problem my
> initialization procedure is very slow).
> 4) Compiled and builded.

> If I try to call the method of the com object in the server from a client
> (win32 console application) written in vc++, and, during 30 seconds, also
> from an ASP page (that run under IIS4.0), I end up with two distinct exe
> server loaded in memory (I see them with. Task Manager).

> What I'm trying to do is to have ONLY ONE com server responding to the two
> requests. Is it possible?

> Thankyou in advance

> Loris



Sat, 26 Jun 2004 14:03:02 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Single instance Com server

2. Create instance of an com object inside a the Com server

3. why Can\'t create COM Instance After registering COM Server Successfully

4. ATL MFC EXE singleton server, single instance application

5. ATL MFC EXE singleton server, single instance application

6. single instance of EXE server

7. single server instance

8. single instance of COM

9. How to make com component single instance

10. Attach multiple executables to single ATL COM EXE instance

11. Single COM Instance for All Processes and Threads?

12. Single COM object instance

 

 
Powered by phpBB® Forum Software