How to Call COM VB6 DLL in WCF Application

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.

  1. GrooveScript.GrooveVCardViewerClass c = new GrooveScript.GrooveVCardViewerClass();  
  2. c.Clear();
Step 6: Now we will deploy the WCF application to an IIS Server.

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

Happy Coding..

Up Next
    Ebook Download
    View all
    Learn
    View all