Monday 15 July 2013

interop - MSMQQueueManagement error when creating a class instance -



interop - MSMQQueueManagement error when creating a class instance -

i have routine counts on msmq queue. have been using code years on 2003 , 2008 server no trouble. updating code run on 2012r2 server , test compiling vs2013 premium on windows 8.1 using next code:

string spath; int32 ncount = 0; object opath, onull, oserver; string [] sparts; char [] sseps = { ':', '\\' }; msmq.msmqqueuemanagementclass mgmt; // // configuration path standard .net path. dcom need // direct= prefixed // spath = "direct=os:" + m_queueconfig.queuepath; // // split string looking sever name // sparts = spath.split( sseps, stringsplitoptions.removeemptyentries ); // // count server // mgmt = new msmq.msmqqueuemanagementclass(); seek { opath = spath; onull = type.missing; if( sparts.length < 2 || sparts[1] == "." ) oserver = environment.machinename; else oserver = sparts[1]; mgmt.init( ref oserver, ref onull, ref opath ); ncount = mgmt.messagecount; } catch( exception ) { ncount = 0; } { marshal.releasecomobject( mgmt ); } homecoming ncount;

this error on "mgmt. = new msmq.msmqqueuemanagementclass()" statement next error:

retrieving com class mill component clsid {33b6d07e-f27d-42fa-b2d7-bf82e11e9374} failed due next error: 80040154 class not registered (exception hresult: 0x80040154 (regdb_e_classnotreg)).

looking in hkey_classes_root hive can find 39ce96fe-f4c5-4484-a143-4c2d5d324229 pointed mqoa.dll in system32, not clsid error, 80040154 is.

i have tried creating new typelib using system32/mqoa.dll still same error. doing wrong?

according registry have msmq version 6.2.9200 installed , works application can't management interface load.

mgmt.init( ref oserver, ref onull, ref opath );

the msmqqueuemanagement interface not have init() method. looks me mixing different coclasses. 39ce96fe guid msmqmanagement, 33b6d07e guid msmqqueuemanagment. latter 1 not supposed appear in registry runtime error exclusively expected. fix:

mgmt = new msmq.msmqmanagement(); // etc..

interop msmq

No comments:

Post a Comment