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.
- .NET >= 8.0 SDK
- Python => 3.9
dotnet publishOpen a new PowerShell window as an Administrator and run the following command:
.\server\bin\Release\net8.0\publish\server.exe /regserverNow the server is registered and ready to be used by COM clients.
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.txtNow you can run the client:
python .\client\client.pyOpen a new PowerShell window as an Administrator and run the following command:
.\server\bin\Release\net8.0\publish\server.exe /unregserver