views:

78

answers:

3

We have an ASP.NET 1.1 web application. It invokes a C++ COM object which in turn invokes a .NET COM object. Originally, this .NET COM object was a .NET 1.1 assembly. Now, we need to modify this .NET COM object and in the process we now use Visual Studio 2008 so it is a .NET 2.0 COM object now. We now find that our ASP.NET 1.1 web application can still invokde the C++ COM object, but the C++ COM object is unable to call CoCreateInstance() on the new .NET 2.0 COM object. When we configure the web app to use .NET 2.0 Framework, the C++ COM object can invoke the .NET 2.0 COM object, but doing so breaks the web app.

At the moment, I'm planning on rebulding the .NET COM object using Visual Studio .NET 2003 so I can make it a .NET 1.1 assembly. But I would rather not do that if possible. I know we should also upgrade our web app to .NET 2.0 too, but that's going to take longer.

So, is there any way for our ASP.NET 1.1 web app to be able to invoke the .NET 2.0 COM object through the C++ COM object?

Thank you for any suggestions.

-Dave Herrmann

+1  A: 

Not if you run it in-process. The .Net v1.1 and v2.0 runtimes cannot co-exist in a process. Which ever is loaded first, wins.

You should be able to run it in a COM+ activation context in a separate process, however. This might be an expedient solution to your situation.

codekaizen
Yeah, this is what I am finding out. My .NET 2.0 COM assembly is an in-proc COM object since it runs as part of IIS. So, I think my only solution is to re-install the old Visual Studio .NET 2003 development environment and rebuild my assembly there using .NET 1.1.Thanks for the replies.-Dave Herrmann
Dave Herrmann
You can run in-proc COM objects in a separate process, and have the COM+ infrastructure marshal the calls for you. It's a simple matter of configuration. You might try that first...
codekaizen
A: 

Quick suggestion - it may not make anything easier...but there is a possible way around this, why not create a memory map for IPC communication between the .NET 1.1 and the .NET 2.0 application, say, for example, C++ COM creates a memory map for reading/writing, the .NET 1.1 object opens the memory map, write some data, the C++ COM object reads it and delegates the call to the .NET 2 COM object...and return back data via the memory map...sorry if I could not give you a better suggestion than that...are you constrained by time effort?

1.1 .NET -> C++ COM -> .NET 2.0 COM

Hope this helps, Best regards, Tom.

tommieb75
I think just configuring a COM+ context would be much easier... no code + recompile needed.
codekaizen
@codekaizen: oh ok...my suggestion was a bit extreme.... :)
tommieb75
A: 

If I understand you correctly, you want to build your assembly on 1.1, not on 2.0. Why don't you try using the command-line compiler? You don't need to install VS 2003 just to compile and build an assembly.

If you don't know how to start, install VS on a sandbox machine, build a project and check the output window - you will see what commands are used to compile and build (csc.exe or vbc.exe being the most important ones) In most cases, it's not rocket science.

Another option: move to 2.0 in general -- won't really hurt.

P.S.: .NET COM object is bad spelling. Call it an assembly.

Dercsár