how to create DCOM dll and use it from other computer c#


I want to create sample application using .NET as well as in VB6, and I want to use those application dll from other computer, I have gone through several steps but it's confusing and still not able to find exact working example.

I have created one sample class library project and signed with key imported by following command:

sn.exe -i C:\Test\D\test.snk testD

and on post-build I am importing file tlb from following command:

%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\RegAsm /codebase "$(TargetPath)" /tlb:"$(TargetDir)$(TargetName).lib"

Now I am able to build project successfully after updating code in AssemblyInfo.cs as follows:

[assembly: ApplicationName("D")] // name space name
[assembly: ApplicationActivation(ActivationOption.Library)]
[assembly: AssemblyKeyFile("test.snk")] // exported key name.

Now I have two files, one dll and one lib file in the bin folder when I build project.

Bow I am confused what to do. How can I access from other computer and how can I create same for VB6.

my Project Struture i want to create application which can be installed in different computer also can communicate with each other over network

can any one guide me with steps that how can i create application as well as how can i create setup for the same ?

i have uploaded source code , i am able to create installable config but not able to call from other computer

and this is below my client code with reference

Type remoteSessionContextType = Type.GetTypeFromProgID("D.Person", "", true);
var dcomObject = Activator.CreateInstance(remoteSessionContextType);

string version = dcomObject.ToString(); Console.WriteLine(version);

i am getting error as below.

retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

asked on Stack Overflow Dec 31, 2019 by Viken Patel • edited Jan 3, 2020 by Viken Patel

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0