Reader Level:
ARTICLE

How to Call COM VB6 DLL in WCF Application

On September 12, 2012 Articles | WCF with C#
How to call a COM\VB6 DLL in a WCF Application.
  • 0
  • 0
  • 7502

A few days back I was working on a POC where I needed to add a COM reference to a WCF application. When the client calls the WCF service, a method call will go to the COM dll. I have done much R&D on it because I am doing it for the first time. So I found on the internet that there is not a good solution for it. So I decided I need to write complete instructions for doing it.

Let's see how to call a COM\VB6 dll in WCF.

Step 1: First of all we will create a new WCF Application Project.

Step 2: Now we will add a COM reference.

add-COM-reference.png

Step 3: Now we will go to the Properties of the COM Assembly that we added a reference for. See the following image:

COM-assembly-Property-window.png
 
Step 4: Now we need to change Embed Interop Types =TRUE

change-Embed-Interop-Types.png

Step 5: Now we can use that COM dll in a WCF service.

GrooveScript.GrooveVCardViewerClass c = new GrooveScript.GrooveVCardViewerClass();
c.Clear();

 
Step 6: Now we will deploy the WCF application to an IIS Server.

deploy-WCF-application-on-IIS-Server.png

Happy Coding..
 

Amit Patel

I am  C# Corner MVP in Q2 2012.  I have 10 years of experiences in Microsoft technologies. I am very much passionate about Web technology. My core skill is ASP.NET, WCF, C#, JQuery and...

  • 190rank
  • 412K readers
  • 1times
COMMENT USING

Trending up