Unable to get correct assembly codebase when using COM+ 
Author Message
 Unable to get correct assembly codebase when using COM+

I'm in a project where we are using several tiers and using COM+
(Enterprise Services) in .NET. In order to use config files in the
COM+ packages we have made a wrapper class that reads an XML-file
placed in the packages execution path. The file is namned like
BusinessServices.Dll.Config.

In order to be able to get the path to the file without hardcoding it
in each client we have implemented a method that uses
[Assembly].GetCallingAssembly.CodeBase + ".config" to retreive the
file name.

The problem is that the CodeBase address is
c:\winnt\microsoft.net\framework\v1.0.3705\mscorlib.dll.config instead
of c:\myproject\BusinessServices\bin.

I would like some help to be able to retreive the correct path. Any
ideas?

The packages is set to .Server but nothing changes when setting the
packages to Library.

Cheers
Magnus



Sun, 10 Apr 2005 23:07:55 GMT  
 Unable to get correct assembly codebase when using COM+
I don't think you will be able to use GetCallingAssembly() in this scenario.
Your assembly is being called through COM+ runtime which involves
managed/unmanaged transition and the reflection information might not be
preserved.

How about using COM+ object construction services? They are easily
accessible via ConstructionEnabledAttribute. Hope that will work for you.

Karol, SDE
VB.NET

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> I'm in a project where we are using several tiers and using COM+
> (Enterprise Services) in .NET. In order to use config files in the
> COM+ packages we have made a wrapper class that reads an XML-file
> placed in the packages execution path. The file is namned like
> BusinessServices.Dll.Config.

> In order to be able to get the path to the file without hardcoding it
> in each client we have implemented a method that uses
> [Assembly].GetCallingAssembly.CodeBase + ".config" to retreive the
> file name.

> The problem is that the CodeBase address is
> c:\winnt\microsoft.net\framework\v1.0.3705\mscorlib.dll.config instead
> of c:\myproject\BusinessServices\bin.

> I would like some help to be able to retreive the correct path. Any
> ideas?

> The packages is set to .Server but nothing changes when setting the
> packages to Library.

> Cheers
> Magnus



Mon, 11 Apr 2005 04:06:10 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Getting correct date/time using INET

2. Forcing Correct Assembly Version

3. One or more of the types in the assembly unable to load

4. Using types in a different assembly given that the type may be used or not used

5. Getting exception when using WithEvents & COM

6. Getting main assembly from DLL

7. Accessing COM object from VB.NET Assembly

8. Getting hold of Assembly Info

9. Codebase and Client/Server--Anyone using?

10. Loading MSFlxGrd.ocx using codebase

11. COM - accessing the correct class version in VB Script

12. COM Up! 2.0 released (correct URL)

 

 
Powered by phpBB® Forum Software