c# - DCOM object - CoCreateInstanceEx succeeds, but Activator.CreateInstance fails -


native c++ code:

int main() {    auto hr = coinitializeex(nullptr, coinit_multithreaded);      coserverinfo server = {0, l"win7x64", nullptr, 0};     multi_qi qi = {&iid_xxxservice, nullptr, 0};     hr = cocreateinstanceex(clsid_xxxservice, nullptr, clsctx_remote_server, &server, 1, &qi); } 

succeeds, threading model. or without call coinitializesecurity. when trying instantiate same object .net/c#, fails 0x80070005:

static void main(string[] args) {     var machinename = "win7x64";     try     {         type dcomtype = type.gettypefromclsid(typeof(xxxservice).guid, machinename, false);         object dcomobj = activator.createinstance(dcomtype);                    }     catch (exception ex)     {         console.writeline(ex.message);     } } 

i have tried latter coinitializesecurity (dllimported), mta , sta thread attribute, uac elevated process, fails. if machinename current machine, works (yes, current development machine has same com interface, , class registered).

edit: in order call coinitializesecurity, setting 'enable visual studio hosting process' must disabled. still then, createinstance fails.

with native code, works. managed code, never works. done?

edit2: com security on remote machine:

  • access permissions (limits): everyone, anonymous logon (among other common) - full access.
  • access permissions (default): self, system, anonymous logon - full access all.
  • launch & activation (limits): everyone, dcom users, anonymous logon (among other common) - full access.
  • launch & activation permissions (default): system, network, anonymous logon, interactive - full access all.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -