开发者

COM on 64 Bit Platform

I'm using a 3rd party COM Library with C#, all works fine on 32 bit XP. I use tlbimp to create the wrapper, add a reference all works. However, when porting to our Server environment which is 64 bit Windows Server 2008, I've run into a road block.

The code below only runs properly when I right click and test it, ie run开发者_StackOverflow社区 within the VS environment. The code does not work when compiled to a Console App, nor does the code work in an Assembly whether in test or called from a console App. In an attempt to get it working I'm running as Administrator and in a 32bit command window - still nothing grouper is always null, and no exception is thrown, indicating that GrpSvr.GrpCall is a valid Com Library name.

    string sMessage = "no grouper";
    GrpSvr.GrpCall grouper = Activator.CreateInstance(
        Type.GetTypeFromProgID("GrpSvr.GrpCall")) as GrpSvr.GrpCall;
    if (grouper != null)
        sMessage = grouper.GroupInit(@"C:\CmdGrp.txt", true, true);

    Console.WriteLine(sMessage);


Try using COM+ as host, and keep your application compiled for 64 bits. For more info see this link


It sounds like the 3rd party COM DLL is 32 bits only. You have to configure your app to run as 32 bits only, instead of any cpu.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜