according to Ryan Lu (Microsoft)
http://groups.google.com/groups?selm=lmdtVBOVCHA.2096%40cpmsftngxa08&oe=UTF-8&output=gplainyou can achieve using DCOM in .NET in three ways.1. Use the DCOMCNFG in the client and specify the remote server name for the server object. So when you create an instance of an object in the .NET the object will get created in the remote server machine. But in this case the remote machine name is taken from the registery and you will not be able to specify a remote machine name dynamically.2. Use Activator.CreateInstance as below and then cast it to the specific interface. Type t = Type.GetTypeFromProgID("testcom.testapi","lijut01",true);
object obj = Activator.CreateInstance(t);
TestCOMLib.testApi te= (TestCOMLib.testApi ) obj; http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q318614&In this case you can specify the remote machine name dynamically.3. Write a .NET wrapper for the remote server. The wrapper will run in the remote machine. Then use the .NET remoting to talk between .NET client and that .NET wrapper which in turn talks with the local legacy COM.also see discussions in this thread:http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=%23%2414g0aSCHA.2336%40tkmsftngp08&rnum=2&prev=/groups%3Fq%3Dremoting%2Bcom%2Bc%2523%2Bdcom%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D%2523%252414g0aSCHA.2336%2540tkmsftngp08%26rnum%3D2
http://groups.google.com/groups?selm=lmdtVBOVCHA.2096%40cpmsftngxa08&oe=UTF-8&output=gplainyou can achieve using DCOM in .NET in three ways.1. Use the DCOMCNFG in the client and specify the remote server name for the server object. So when you create an instance of an object in the .NET the object will get created in the remote server machine. But in this case the remote machine name is taken from the registery and you will not be able to specify a remote machine name dynamically.2. Use Activator.CreateInstance as below and then cast it to the specific interface. Type t = Type.GetTypeFromProgID("testcom.testapi","lijut01",true);
object obj = Activator.CreateInstance(t);
TestCOMLib.testApi te= (TestCOMLib.testApi ) obj; http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q318614&In this case you can specify the remote machine name dynamically.3. Write a .NET wrapper for the remote server. The wrapper will run in the remote machine. Then use the .NET remoting to talk between .NET client and that .NET wrapper which in turn talks with the local legacy COM.also see discussions in this thread:http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=%23%2414g0aSCHA.2336%40tkmsftngp08&rnum=2&prev=/groups%3Fq%3Dremoting%2Bcom%2Bc%2523%2Bdcom%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D%2523%252414g0aSCHA.2336%2540tkmsftngp08%26rnum%3D2
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货