Discussion:
Forcing a single instance of a DCOM server
(too old to reply)
Troy Johnson
2003-10-10 16:43:36 UTC
Permalink
I have a DCOM server that maintains information that needs
to be accessed by multiple clients. The clients use
CoCreateInstance to get a smart pointer to the server.
Sometimes the CoCreateInstance call actually launches a new
instance of the exe server which creates a horrible problem
since the clients are now operating on different data. How
can I force a client to use an existing instance of the
DCOM server. Also, is there any way to know if there is an
instance running?
Brian Muth
2003-10-10 17:27:52 UTC
Permalink
Using DCOMCNFG, ensure that the identity of the DCOM is set to a specific
account.

I suspect you have left it as the launching user. If different users access
the DCOM server, COM services has no choice but to start a fresh process to
meet the security requirements you have chosen (by default)

Brian Muth
Post by Troy Johnson
I have a DCOM server that maintains information that needs
to be accessed by multiple clients. The clients use
CoCreateInstance to get a smart pointer to the server.
Sometimes the CoCreateInstance call actually launches a new
instance of the exe server which creates a horrible problem
since the clients are now operating on different data. How
can I force a client to use an existing instance of the
DCOM server. Also, is there any way to know if there is an
instance running?
LiquidJ
2003-10-10 17:44:58 UTC
Permalink
Assuming you also have used DECLARE_CLASSFACTORY_SINGLETON and
REGCLS_MULTIPLEUSE. You probably have by the sounds of it, but just for the
record...

To see if there's already an instance running (this question may be moot
after Brian's answer), you can check to see if a named mutex specific to
your process has been created, if not, create it, if so, then do something
else like return an error.

A better to resolve both issues might be to use the ROT.


{L}
Post by Brian Muth
Using DCOMCNFG, ensure that the identity of the DCOM is set to a specific
account.
I suspect you have left it as the launching user. If different users access
the DCOM server, COM services has no choice but to start a fresh process to
meet the security requirements you have chosen (by default)
Brian Muth
Post by Troy Johnson
I have a DCOM server that maintains information that needs
to be accessed by multiple clients. The clients use
CoCreateInstance to get a smart pointer to the server.
Sometimes the CoCreateInstance call actually launches a new
instance of the exe server which creates a horrible problem
since the clients are now operating on different data. How
can I force a client to use an existing instance of the
DCOM server. Also, is there any way to know if there is an
instance running?
Troy Johnson
2003-10-10 19:48:05 UTC
Permalink
Brian,

I'm a relative newbie to COM in general. Could you describe
in a little more detail how to do what you suggest? I do
know how to run the dcomcnfg app, but from there I'm a
little lost.

Thanks,

Troy
-----Original Message-----
Using DCOMCNFG, ensure that the identity of the DCOM is
set to a specific
account.
I suspect you have left it as the launching user. If
different users access
the DCOM server, COM services has no choice but to start a
fresh process to
meet the security requirements you have chosen (by default)
Brian Muth
Post by Troy Johnson
I have a DCOM server that maintains information that needs
to be accessed by multiple clients. The clients use
CoCreateInstance to get a smart pointer to the server.
Sometimes the CoCreateInstance call actually launches a new
instance of the exe server which creates a horrible problem
since the clients are now operating on different data. How
can I force a client to use an existing instance of the
DCOM server. Also, is there any way to know if there is an
instance running?
.
Alexander Nickolov
2003-10-10 21:44:13 UTC
Permalink
Select your server in the list, open its property sheet, go to the
Identity tab and choose This User, then fill in the NT account
your server is to run under.
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: ***@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
Post by Troy Johnson
Brian,
I'm a relative newbie to COM in general. Could you describe
in a little more detail how to do what you suggest? I do
know how to run the dcomcnfg app, but from there I'm a
little lost.
Thanks,
Troy
-----Original Message-----
Using DCOMCNFG, ensure that the identity of the DCOM is
set to a specific
account.
I suspect you have left it as the launching user. If
different users access
the DCOM server, COM services has no choice but to start a
fresh process to
meet the security requirements you have chosen (by default)
Brian Muth
Post by Troy Johnson
I have a DCOM server that maintains information that needs
to be accessed by multiple clients. The clients use
CoCreateInstance to get a smart pointer to the server.
Sometimes the CoCreateInstance call actually launches a new
instance of the exe server which creates a horrible problem
since the clients are now operating on different data. How
can I force a client to use an existing instance of the
DCOM server. Also, is there any way to know if there is an
instance running?
.
Tian Min Huang
2003-10-13 05:32:21 UTC
Permalink
Hi Troy,

Thanks for your post.

1. In the "Beware of Launching User" section of the MSDN article "Eight
Lessons from the COM School of Hard Knocks" describes the detailed
information on this issue. You can access the article at
http://msdn.microsoft.com/msdnmag/issues/1100/wicked/.

2. If you want to implementing an singleton server, I believe the following
tutorial is very helpful:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html
/vclrfstep3implementingserver.asp

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Loading...