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.
Step 3: Now we will go to the Properties of the COM Assembly that we added a reference for. See the following image:
Step 4: Now we need to change Embed Interop Types =TRUE
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.
Happy Coding..