Last post Jun 21, 2007 03:26 PM by dbland07666
Jun 21, 2007 10:28 AM|dbland07666|LINK
I have an odd problem, not sure which forum to put it in. We have a .Net 1.1 assembly installed on a server and made to be callable by a VB6 COM+ object (using the methodology described in
This has worked without incident for a couple of years. The .Net assembly calls a web service and it gets the name of the web service from machine.config using ConfigurationSettings.AppSettings explicitely to look up the URL. Machine.config is located
in the normal location, C:\WINNT\Microsoft.NET\Framework\v1.1.4322\CONFIG
We recently installed .Net 2.0 on this server and this assembly suddenly started failing with an "object reference not set" error. We were able to trace the error to the fact that our assembly was not finding the config setting. When we put the config
settings in the .Net 2 machine.config, located at :\WINNT\Microsoft.NET\Framework\v2.0.50727\CONFIG, it worked!! Furthermore, we have confirmed that this is the case on our DEV server and also on our UAT server (we'll be moving the change to prod shortly).
IOW, our .Net 1.1 assembly is now looking for the .Net 2 machine.config!!!!! There has been no change to our assembly, it was last installed over 2 years ago.
After reading this article,
http://dotnetdebug.blogspot.com/2006/01/running-net-20-and-11-side-by-side.html, describing a possible version conflict with com callable assemblies, I went into the registry to check all references to the assembly to see what run time version was listed,
and as expected, the .Net runtime version is 1.1, not 2! So it's a mystery.
Though I now know how to fix this problem, I am mystified as to why our 1.1 assembly is using the .Net 2.0 machine.config. Any thoughts, anyone?
Jun 21, 2007 03:26 PM|dbland07666|LINK
I got my answer. From
http://msdn.microsoft.com/en-us/library/tkyzwk9k.aspx it says, "By default, COM interop applications calling to managed code use the latest version of the runtime installed on the computer"
It's not clear whether there is really a solution other than updating the .Net 2 machine.config. Assemblies can be bound to a specific .Net runtime by using the
<assemblyBinding> in app.config, but there is no app.config since this is being called by a COM object. I'm not sure whether this tag can even be used in machine.config, but even if it can be, putting it there is no easier (and arguably less
clear) than just adding my tag to the .Net 2 maching.config