wcf - Error in exposing c# DLL to VB6 -
i ask how exposed c# dll vb6. purpose of exposing dll consume wcf service vb6 application since cant consume directly wcf service.
below code in c#
[guid("116cca1e-7e39-4515-9849-90790da6431e")] [classinterface(classinterfacetype.none),comsourceinterfaces(typeof(itestbillerv10service))] [comvisible(true)] public class testbillerv10 : itestbillerv10service { testbillerinquiry.testbillerinquiryclient _testbillerinquiry; public testbillerv10() { _testbillerinquiry = new testbillerinquiry.testbillerinquiryclient(); system.net.servicepointmanager.expect100continue = false; } /// <summary> /// inquire if account no valid or not /// </summary> /// <param name="accountno">account no. check</param> /// <param name="userid">user id of terminal</param> /// <returns>string array index[0] = response code(yes/no), index[1] = description response, index[2] = error code if response code no</returns> [comvisible(true)] [dispid(1)] public string[] inquiry(string accountno, string userid) { var newinquiry = new testbillerinquiry.testbillerinquiryrequest {accountnumber = accountno, userid= userid }; testbillerinquiry.testbillerinquiryresponse response = _testbillerinquiry.inquiry(newinquiry); var retval = new string[3]; retval[0] = response.response; retval[1] = response.message; retval[2] = response.error; return retval; } } and simple interface below
/// <summary> /// inquire if account no valid or not /// </summary> /// <param name="accountno">account no. check</param> /// <param name="userid">user id of terminal</param> /// <returns>string array index[0] = response code(yes/no), index[1] = description response, index[2] = error code if response code no</returns> [comvisible(true)] public interface itestbillerv10service { [dispid(1)] string[] inquiry(string accountno, string userid); } below how try consume on vb6 returns
runtime erro 429 says acvtive x component cant create object.
dim testbillerv10 v10bridge.testbillerv10 set testbillerv10 = new testbillerv10
try 2 changes. first class needs progid attribute (and don't use comsourceinterfaces got rid of it):
[guid("116cca1e-7e39-4515-9849-90790da6431e")] [classinterface(classinterfacetype.none)] [comvisible(true)] [progid("mynamespace.testbillerv10")] public class testbillerv10 : itestbillerv10service your interface needs guid , interfacetype:
[guid("782ab14d-be28-4b47-9498-dff94b457e6d")] [interfacetype(cominterfacetype.interfaceisidispatch)] [comvisible(true)] public interface itestbillerv10service
Comments
Post a Comment