Sharing assembly between ASP.NET hosted application and a .Net application

docflied

Newcomer
Joined
Nov 28, 2009
Messages
17
Hey everyone, Wish you merry Xmas and an excellent 2010

Well once again need ur help and advices to understand a tricky issue.

I got a shared assembly (say SharedAssembly.dll) installed in the GAC, this assembly exposes a module (static class vb equivalent) called CustomSettings inluding some properties to set Log path, DataBase connection string and some other behavior stuff.

Say u have a ASP.NET web service referecing this SharedAssembly.dll
Say u have a .Net application referencing the web serivce and SharedAssemlbly.dll

Before calling any web service method, the .Net application assign values to exposed and shared properties.

Once the web service called and within it, obviously the effective referenced assembly is not the typically the same (shadow copy done by binding mechanism thought?) and all initialization done in the .net application before calling the web service is useless!
Thought that is ASP.NET application dedicated AppDomain isolate the referenced dll.

How may I work around this ? Allready passed a huge amount of time reading and reading, but can't find the best way to do this properly.

Thank u for ur hêlp
 
Each application will have the dll loaded into it's own memory space and any changes are local to it's address space. If you need to share data between two .Net applications (more accurately Application Domains) you would need to use some form of interprocess communication (remoting, sockets etc.)

Out of interest what kind of information is being stored / used with these shared properties? There may be an alternate way of achieving what you are after.
 
Thank u for ur help.

Shared data are :
Data base connection string (String)
Log path (String)
Log verbosity (Enumeration)

Ok a related question, assuming that the web service referencing the shared and GACed dll creates its own AppDomain (own sandbox)

Is there a simple way to tell a .net application (winform or class library or another ASP.NET application) to run into the same AppDomain (joining the remote domain?)
 
Surely easier. In this case the opened connection to the database in the web service and the opened one in the winforms are kept duplicated, same thing for Log file stream.
When u asked kind of shared information I didn't precised need of sharing same Database connection. Sorry for that.
Guess no way to this without exchanging interprocesses as u mentioned.
Hesistating between .Remoting and WCF.
I think I'll first read more about all this stuff, cause I dont master context and AppDomain in .net but I think it should be similar patterns as Java

Once again thank u, and hope u a very Happy New Year.
 
Back
Top