masterchris_99
masterchris_99

Reputation: 2733

COM Server with only one running instance (Service, Singleton, ...)

for a third party application I need to program a Com Server. This is no problem but I need the COM Server to run only in one instance. This instance should run as a service so that it is not created every time new.

The COM Application is created by vbs every time new.

Dim myCom
Set myCom = Nothing                                                   
Set myCom = CreateObject("MyCom.Application")
myCom.DoAction

The Com Server itself creates a database connection and I want to connect once and not for every creation.

I hope you understand what I mean. If not contact me pleade via comment. Thanks.

Chris

Upvotes: 1

Views: 1054

Answers (1)

Aykut Çevik
Aykut Çevik

Reputation: 2088

Take a look at ExeCOMServer:

ExeCOMServer encapsulates the skeleton of an out-of-process COM server in
C#. The class implements the singleton design pattern and it's thread-safe. To start the server, call CSExeCOMServer.Instance.Run(). If the server is running, the function returns directly.

Upvotes: 1

Related Questions