Interop config file issue

Howdy all- I am having an interesting problem trying to run some .NET 2.0 dlls in the GAC on an ASP page.

On my dev machine (WinXP, 1.1 and 2.0 installed) I have built the dlls, added them to the GAC, put the config file in system32/dllhost.exe.config and called dlls from an ASP page no problem. Page displays and the dlls see the config file.

I do the same in production (Win2003 Server, 1.1 and 2.0 installed) and I get an error which indicates that the code isn't seeing the config file (it isn't getting a connection string). I have tried numerous things to resolve this, with some interesting results:

1) Added w3wp.exe.config and inetinfo.exe.config to the system32 dir as well as the system32/inetsvr dir with the same results as above.

2) Added a line to the main dll constructor that points to a custom config location (AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", @"C:\Inetpub\wwwroot\dwww.xxx.com\config\ce.config");).
Here is where it gets interesting; when I call the ASP page with the dll call, the app pool bombs out. If I look at the App event log, I see this:.
"NET Runtime version 2.0.50727.42 - Fatal Execution Engine Error (7A05E2B3) (80131506)"
(among others)
If I remove the custom config file, the app goes back to complaining about not having a config file (no connection string). If I replace the config file with a 1.1 format config file, I get the same thing (complains about no connection string, BUT doesn't bomb out). Obviously it is seeing the config file.

3) Added the dlls to COM+ and pointed the application root directory setting to a directory that contains an application.config file and an application.manifest file. I see the same behavior (sort of). If the config file is my 2.0 config file, the COM+ app won't start; it bombs out. The system event log has the following "SideBySide" error:
Syntax error in manifest or policy file "C:\Inetpub\wwwroot\dwww.xxx.com\config\Application.Config" on line 10. The manifest file root element must be assembly."
(among others)
And again, if I change the application.config file to a 1.1 version, COM+ starts fine but then obviously doesn't find my connection string.

I have checked the registry and the dlls and registered with the correct .Net runtime version (v2.0.50727).

Interesting, eh? Anyone have any thoughts? It really seems like the CLR is expecting to find a 1.1 config file and is choking on the 2.0 config.

Any help would be most appreciated.

[2548 byte] By [kgraeme] at [2007-12-24]
# 1
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile will return the configuration file. By default, COM interop will use the latest CLR version.
LucianBargaoanu at 2007-8-31 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 2
Thanks Lucian- that helped a bit.

I have simplified everything and narrowed down the problem somewhat. I

have a simple class with no outside references loaded onto my

Win2003Server box. It is using the w3wp.exe.config file (I wrote the

path to the ASP page calling the object initially before creating the config file.)

If I put an empy config file, like so:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
</configuration>

in place for w3wp.exe.config, it doesn't complain. If I add something like this to the file:
<system.web></system.web>
the page still loads, but I get the following error:

System.Configuration error '80131902'

Configuration system failed to initialize

/test_api.asp, line 21

Now, if I add the following entry to the config file:

<appSettings></appSettings>

The page doesn't load at all and I see the folowign exceptions in the event log:

.NET Runtime version 2.0.50727.42 - Fatal Execution Engine Error (7A05E2B3) (80131506)

Faulting application w3wp.exe, version 6.0.3790.1830, stamp 42435be1, faulting module mscorwks.dll, version 2.0.50727.42, stamp 4333e7ec, debug? 0, fault address 0x000e9f96.

I see the same behavior on two servers.



kgraeme at 2007-8-31 > top of Msdn Tech,.NET Development,Common Language Runtime...
# 3
Any progess on this issue? I am seeing same error message
usuthar at 2007-8-31 > top of Msdn Tech,.NET Development,Common Language Runtime...

.NET Development

Site Classified