Saturday, March 24, 2012

Server wide objects

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 crea
ted a namespace with all of my classes and us it each bin directory for each
site. It is a pain to do u
pdates. What would be the correct terminology?"Chris Glenn" <Chris Glenn@.discussions.microsoft.com> wrote in message
news:278EF145-D43C-4DD1-A161-419E4B805229@.microsoft.com...
> 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.
--
John Saunders
johnwsaundersiii at hotmail
simply create the objects you want to share in seperate projects. Compile t
hem to a dll and add references from your projects.
"Chris Glenn" wrote:

> I want to share my .net objects amongst several websites on the same server. Can a
nyone direct me to an article or information on how to do this. I created a namespac
e 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.
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.
"John Saunders" <johnwsaundersiii@.notcoldmail.com> wrote in message
news:Osui8QiXEHA.212@.TK2MSFTNGP12.phx.gbl...
> "Chris Glenn" <Chris Glenn@.discussions.microsoft.com> wrote in message
> news:278EF145-D43C-4DD1-A161-419E4B805229@.microsoft.com...
> 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.
> --
> John Saunders
> johnwsaundersiii at hotmail
>
"Kevin Spencer" <kspencer@.takempis.com> wrote in message
news:uLBjECqXEHA.3612@.tk2msftngp13.phx.gbl...
> 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.
--
John Saunders
johnwsaundersiii at hotmail
Change the word objects to classes. I'm assuming that you meant classes and
not instances of classes (objects).
"Scott Simons" wrote:
> simply create the objects you want to share in seperate projects. Compile
them to a dll and add references from your projects.
>
> "Chris Glenn" wrote:
>
do updates. What would be the correct terminology?
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.
"John Saunders" <johnwsaundersiii@.notcoldmail.com> wrote in message
news:OlL#$aqXEHA.3944@.tk2msftngp13.phx.gbl...
> "Kevin Spencer" <kspencer@.takempis.com> wrote in message
> news:uLBjECqXEHA.3612@.tk2msftngp13.phx.gbl...
> the
> you
> rebooting,
> application,
> 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.
> --
> John Saunders
> johnwsaundersiii at hotmail
>

0 comments:

Post a Comment