Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

COM OutProc Server Demo

Introduction

This is a simple demo of an out-of-process COM server. The server is implemented in C# and the client is implemented in Python.
The OutProcServer class shows how to register a .NET type for use by COM clients as a local server.
The local server is implemented as a console application that listens for incoming connections from COM clients.
The new instance of the .NET type is registered as MultipleUse, which means that a client uses the same process to call methods on the .NET type.

Pre-requisites

  • .NET >= 8.0 SDK
  • Python => 3.9

Build the .NET server

dotnet publish

Register the .NET server

Open a new PowerShell window as an Administrator and run the following command:

.\server\bin\Release\net8.0\publish\server.exe /regserver

Now the server is registered and ready to be used by COM clients.

Run the python client

Open a new PowerShell window as a regular user and run the following commands:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r .\client\requirements.txt

Now you can run the client:

python .\client\client.py

Unregister the .NET server

Open a new PowerShell window as an Administrator and run the following command:

.\server\bin\Release\net8.0\publish\server.exe /unregserver