Server wide objects

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to share my .net objects amongst several websites on the same server. Can anyone direct me to an article or information on how to do this. I created a namespace with all of my classes and us it each bin directory for each site. It is a pain to do updates. What would be the correct terminology?
 
Chris Glenn said:
I want to share my .net objects amongst several websites on the same
server. Can anyone direct me to an article or information on how to do this.
I created a namespace with all of my classes and us it each bin directory
for each site. It is a pain to do updates. What would be the correct
terminology?

I don't believe there's a way to do this. Each web application runs in its
own AppDomain and can't simply "share" objects with another.

The best you could do would be to persist your object in a database and
synchronize changes to it.
 
simply create the objects you want to share in seperate projects. Compile them to a dll and add references from your projects.
 
I don't believe there's a way to do this.

Well, there is one way. You can put the classes into the Global Assembly
Cache. However, this is problematic. Unless you use versioning, updating the
DLLs requires a reboot of the machine to "take." If you use versioning, you
can put multiple versions of the same class into the GAC without rebooting,
but you then have to refer to the correct version in the client application,
which negates the convenience of not having to update each app.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Kevin Spencer said:
Well, there is one way. You can put the classes into the Global Assembly
Cache. However, this is problematic. Unless you use versioning, updating the
DLLs requires a reboot of the machine to "take." If you use versioning, you
can put multiple versions of the same class into the GAC without rebooting,
but you then have to refer to the correct version in the client application,
which negates the convenience of not having to update each app.

Kevin, the OP spoke of "objects", not of "classes". Classes and other types
can be shared through the GAC, but instances of those types can't be shared
across ASP.NET applications, at least not in a simple manner.

Now, to do it in a less-simple manner, we have to break out of the box, so
to speak. Instead of sharing objects across ASP.NET applications, share them
amongst ASP.NET applications. Remove the objects from the ASP.NET
environment into some other process and then use remoting from ASP.NET to
access them.
 
Hi John,

Of course, you're right. However, he did mention that he was copying DLLs
into multiple bin folders, which seems to indicate to me at least, that he
wasn't using the correct terminology (kind of common around here!), and
meant that he wanted to use the same classes, rather than sharing objects.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top