How to pass data from C# to dll

3

I have project in vb named FamServer. In it , a class named FamApp is available . In that class , a function named FamEnroll is available . I have converted this project to dll .I have added this dll to my project . The famenroll funcion in dll is defined as below :

Public Function FamEnroll(strName As String, strEnrollTemplate As String, strIP As String) As String

I have called this dll by the following code :

FamServer.FamApp famApp = new FamServer.FamApp();

          famApp.FamEnroll(name, Request.Form["LearnModel"], Request.ServerVariables["REMOTE_ADDR"]);

But when I am running this code , I am getting the following error :

Exception Details: System.InvalidCastException: Unable to cast COM object of type 'FamServer.FamAppClass' to interface type 'FamServer._FamApp'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B2CC832C-CF23-4023-9C87-711F425EC323}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

The stack trace is as below :

[InvalidCastException: Unable to cast COM object of type 'FamServer.FamAppClass' to interface type 'FamServer._FamApp'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B2CC832C-CF23-4023-9C87-711F425EC323}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).]
   System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease) +0
   FamServer.FamAppClass.FamEnroll(String& strName, String& strEnrollTemplate, String& strIP) +0
   famenroll2.Page_Load(Object sender, EventArgs e) in f:\ASP.NET Projects\ASPNET\famenroll2.aspx.cs:27
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678

Why am I getting this error ? How can I solve this error ? Please help me .

c#
dll
vb6
asked on Stack Overflow Mar 2, 2017 by Icche Guri • edited Mar 2, 2017 by Icche Guri

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0