c# - Reference c++ unmanaged libraries in WCF service -


i have strange problem referencing c++ (unmanaged) libraries in wcf service.

here there code

using system; using system.collections.generic; using system.data; using system.linq; using system.text;  using varspace.elaboration.operations.managedwrapper; //unmanaged c++ namespace using customilexception;  namespace ilcommonlibrary.core { /// <summary> /// singleton class obtain unique-per thread instance of wpc core client. /// </summary> public class wpccoreclient {     private static readonly object objlock = new object();     private readonly client managedwrapperclient= null; //class coming c++     private static volatile wpccoreclient theinstance;      private wpccoreclient()      {         managedwrapperclient=  new varspace.elaboration.operations.managedwrapper.client();     }      /// <summary>     /// <exception cref="customilexception.coreexception">core internal error.</exception>     /// </summary>     /// <returns></returns>     public static wpccoreclient createinstance()      {          if (theinstance == null) {              try {                  lock (objlock)                   {                     theinstance = new wpccoreclient(); // here have error**                  }              } catch (varspace.localization.managedwrapper.coreexception ex) {                  // error in configuratorview usage                   throw errormanagement.setexception(new customilexception.coreexception(ex.message),                             errorcodes.err_core_client_error,                             "wpccoreclient.createinstance",                             string.format("configuratorclient creation error.")                             );              }          }           return theinstance;     }      /// <summary>     /// make elaboration request wpc core system.     /// manages request has related output data.     /// </summary>     /// <param name="requestxml">xml elaboration input description</param>     /// <param name="timeout">request timeout in milliseconds.</param>     /// <param name="error">output parameter obtain string description of error.</param>     /// <returns>a boolean indicate if execution has been correcly executed or not.</returns>     ///      public bool sendrequesttowpc(string requestxml, int timeout, ref string error)     {         bool success;         int idrequest= 0; /* wpc core id of request elaboration */          error = string.empty;         datatable transactionmessages;         using (transactionmessages = new datatable())         {             try             {                 success = this.managedwrapperclient.executerequest(requestxml, timeout, ref idrequest, transactionmessages);                 if (!success)                 {                     if (transactionmessages.rows.count > 0)                     {                         error = "error code: " + transactionmessages.rows[0].field<int>("ncode") +                                 "error severity: " + transactionmessages.rows[0].field<int>("nseverity") +                                 "message: " + transactionmessages.rows[0].field<string>("nvcmsgtext");                     }                     else                     {                         error = schedulerrequesterror.geterrormessage(idrequest);                     }                 }             }             catch (exception e)             {                 error = e.message;                 return false;             }         }          return success;     } // method end  } // class end } // namespace end  

the error following:

 {"the type initializer '' threw exception."}  {"a nested exception occurred after primary exception caused c++ module fail load.\n"}     @ system.runtime.interopservices.marshal.throwexceptionforhrinternal(int32 errorcode, intptr errorinfo)    @ .docallbackindefaultdomain(intptr function, void* cookie)    @ .defaultdomain.initialize()    @ .languagesupport.initializedefaultappdomain(languagesupport* )    @ .languagesupport._initialize(languagesupport* )    @ .languagesupport.initialize(languagesupport* ) 

the strange thing if call function console application, works!!!

it's related wcf service, don't know verify, made lot of attempts.

can me?

thank you!


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -