473,569 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Force a GAC object out of memory

Currently we are having to do an iisreset to update a gac
component on a web server. Just removing it from the gac
and re-adding it does not update the code executing on the
server. This is not desirable. Is there anyway to force
it out of memory (i am assuming this is the problem). We
have multiple web sites that share the same components.

TIA

jim
Jul 21 '05 #1
6 2011
Hi Jim

Based on my experience, the GAC is an file directory on the disk. That is
to say the component in the GAC is an Dll file, when the problem start, it
will be loaded into the memory, the change to the GAC file will not affect
the running problem.

To achieve your goal, you may try to use the AppDomain.
I assume you are using ASP.NET to develop your website.
When the ASP.NET application began, it is in the default AppDomain, but you
can create another AppDomain to load the Assembly, i.e. the dll, then
unload the AppDomain when you want to unload the Assembly.
[NOTE]
Unload Performs a graceful shutdown of the domain. The application domain
is not unloaded until all threads running in the domain have either stopped
or are no longer in the domain.

That is to say you may need to dynamic Create a new AppDomain to load the
assembly[dll] and unload the AppDomain, every time you want to update the
component.
But it is very complex to call the method in the new created AppDomain,
since in .NET framework the relationship between AppDomains is similar with
it between Process.
And this solution may cause performance hit and security issue.

Can you tell me why you need to update an dll in runtime, as far as I know,
the commercial website will not update their website very frequently?
Maybe there is a better solution for you.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #2
thanks for the response. here is a little more information. we are using
asp.net. for the production sites, its not really an issue becuase we can
pull them out of the nlb group (would rather not reset, but oh well if we
have to, then we can) and update that way. Where we have run into problems
is on our development/testing sites when we need to make changes (usually an
unscheduled/bug fix) and we need to shut everything down, we may update
several times a day. I hope this will stabilize more in a few months (it
should). Life was much easier in the com+ world when we left the objects in
a server side package and just shut the package down and replace the dll.
We have just started (actually 3-4 months ago) building the infrastructure
objects that will live in the gac along with generic site builders and the
changes have been frequent. We have many sites and didn't want to worry
about keeping those objects update to date in all the different bins where
we use the objects. So we were just wondering if there was a way to shut
down everything so we could get the updated code on the next request.

thanks again,

jim
"Peter Huang" <v-******@online.m icrosoft.com> wrote in message
news:bo******** ******@cpmsftng xa06.phx.gbl...
Hi Jim

Based on my experience, the GAC is an file directory on the disk. That is
to say the component in the GAC is an Dll file, when the problem start, it
will be loaded into the memory, the change to the GAC file will not affect
the running problem.

To achieve your goal, you may try to use the AppDomain.
I assume you are using ASP.NET to develop your website.
When the ASP.NET application began, it is in the default AppDomain, but you can create another AppDomain to load the Assembly, i.e. the dll, then
unload the AppDomain when you want to unload the Assembly.
[NOTE]
Unload Performs a graceful shutdown of the domain. The application domain
is not unloaded until all threads running in the domain have either stopped or are no longer in the domain.

That is to say you may need to dynamic Create a new AppDomain to load the
assembly[dll] and unload the AppDomain, every time you want to update the
component.
But it is very complex to call the method in the new created AppDomain,
since in .NET framework the relationship between AppDomains is similar with it between Process.
And this solution may cause performance hit and security issue.

Can you tell me why you need to update an dll in runtime, as far as I know, the commercial website will not update their website very frequently?
Maybe there is a better solution for you.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #3
Hi Jim,

What do you mean by shutting down everything?
As for the COM+, you may try to change your object into serviced component,
which can be served in the COM+.

Serviced Component Overview
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconservicedco mponentoverview .asp

Understanding Enterprise Services (COM+) in .NET
http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/entserv.asp

But I am strange if you shut down the component, what will happen to your
application which is using the shutting down object. This will cause
problem.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #4
for shutting down everything, i meant performing an iisreset. i did think
about inheriting/creating a serviced components instead of gac components,
but didn't want to incur the overhead of a serviced component if i wasn't
going to need any of the features of complus component.

All of our components are stateless in complus, so if one request got
booted, that wouldn't be a problem especially in dev and tip, where as to
perform an iisreset to free the object in the gac, all of the sites we host
will be stopped and resarted, which usually takes about 5 minutes.

thanks, jim

"Peter Huang" <v-******@online.m icrosoft.com> wrote in message
news:FX******** *****@cpmsftngx a06.phx.gbl...
Hi Jim,

What do you mean by shutting down everything?
As for the COM+, you may try to change your object into serviced component, which can be served in the COM+.

Serviced Component Overview
http://msdn.microsoft.com/library/de...us/cpguide/htm l/cpconservicedco mponentoverview .asp

Understanding Enterprise Services (COM+) in .NET
http://msdn.microsoft.com/library/de...us/dndotnet/ht ml/entserv.asp

But I am strange if you shut down the component, what will happen to your
application which is using the shutting down object. This will cause
problem.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Jul 21 '05 #5
Hi Jim

If you really wants to unload the assembly dynamically, I think you may
need to use the AppDomain as I mention in my last post.

AppDomains and Dynamic Loading
http://msdn.microsoft.com/library/de...us/dncscol/htm
l/csharp05162002. asp
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Jim Butler" <un**@companyab c.com>
References: <01************ *************** *@phx.gbl> <bo************ **@cpmsftngxa06 .phx.gbl>
<eU************ **@tk2msftngp13 .phx.gbl>
<FX************ *@cpmsftngxa06. phx.gbl>Subject: Re: Force a GAC object out of memory
Date: Fri, 31 Oct 2003 10:25:51 -0500
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <um************ *@TK2MSFTNGP10. phx.gbl>
Newsgroups: microsoft.publi c.dotnet.genera l
NNTP-Posting-Host: user1.sonu.org 12.39.200.113
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:113863
X-Tomcat-NG: microsoft.publi c.dotnet.genera l

for shutting down everything, i meant performing an iisreset. i did think
about inheriting/creating a serviced components instead of gac components,
but didn't want to incur the overhead of a serviced component if i wasn't
going to need any of the features of complus component.

All of our components are stateless in complus, so if one request got
booted, that wouldn't be a problem especially in dev and tip, where as to
perform an iisreset to free the object in the gac, all of the sites we host
will be stopped and resarted, which usually takes about 5 minutes.

thanks, jim

"Peter Huang" <v-******@online.m icrosoft.com> wrote in message
news:FX******* ******@cpmsftng xa06.phx.gbl...
Hi Jim,

What do you mean by shutting down everything?
As for the COM+, you may try to change your object into serviced

component,
which can be served in the COM+.

Serviced Component Overview

http://msdn.microsoft.com/library/de...-us/cpguide/ht

m
l/cpconservicedco mponentoverview .asp

Understanding Enterprise Services (COM+) in .NET

http://msdn.microsoft.com/library/de...-us/dndotnet/h

t
ml/entserv.asp

But I am strange if you shut down the component, what will happen to your
application which is using the shutting down object. This will cause
problem.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.



Jul 21 '05 #6
thanks for the info,

jim

"Peter Huang" <v-******@online.m icrosoft.com> wrote in message
news:K0******** *****@cpmsftngx a06.phx.gbl...
Hi Jim

If you really wants to unload the assembly dynamically, I think you may
need to use the AppDomain as I mention in my last post.

AppDomains and Dynamic Loading
http://msdn.microsoft.com/library/de...us/dncscol/htm l/csharp05162002. asp
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
From: "Jim Butler" <un**@companyab c.com>
References: <01************ *************** *@phx.gbl>

<bo************ **@cpmsftngxa06 .phx.gbl>
<eU************ **@tk2msftngp13 .phx.gbl>
<FX************ *@cpmsftngxa06. phx.gbl>
Subject: Re: Force a GAC object out of memory
Date: Fri, 31 Oct 2003 10:25:51 -0500
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <um************ *@TK2MSFTNGP10. phx.gbl>
Newsgroups: microsoft.publi c.dotnet.genera l
NNTP-Posting-Host: user1.sonu.org 12.39.200.113
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:113863
X-Tomcat-NG: microsoft.publi c.dotnet.genera l

for shutting down everything, i meant performing an iisreset. i did think
about inheriting/creating a serviced components instead of gac components,but didn't want to incur the overhead of a serviced component if i wasn't
going to need any of the features of complus component.

All of our components are stateless in complus, so if one request got
booted, that wouldn't be a problem especially in dev and tip, where as to
perform an iisreset to free the object in the gac, all of the sites we hostwill be stopped and resarted, which usually takes about 5 minutes.

thanks, jim

"Peter Huang" <v-******@online.m icrosoft.com> wrote in message
news:FX******* ******@cpmsftng xa06.phx.gbl...
Hi Jim,

What do you mean by shutting down everything?
As for the COM+, you may try to change your object into serviced

component,
which can be served in the COM+.

Serviced Component Overview


http://msdn.microsoft.com/library/de...-us/cpguide/ht
m l/cpconservicedco mponentoverview .asp

Understanding Enterprise Services (COM+) in .NET

http://msdn.microsoft.com/library/de...-us/dndotnet/h
t ml/entserv.asp

But I am strange if you shut down the component, what will happen to your application which is using the shutting down object. This will cause
problem.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
810
by: Ganesh | last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a process without have access to the process code. regards Ganesh
6
1599
by: tony | last post by:
hi. how can i force a process /objects / to be always in memory and not in page files in the hd. is there a way to do that in programming ?
16
6718
by: LP | last post by:
Hi, Considering code below. Will it make GC to actually collect. One application creates new instances of a class from 3rd party assembly in a loop (it has to). That class doesn't have .Dispose or any similar method. I want to make sure GC keeps up with the loop. My reasoning if Thread.Sleep(1000) is called; GC will take priority it do its...
3
8983
by: pacemkr | last post by:
Is it possible to force a control to paint to a Graphics object (or Device Context, or a bitmap, anywhere aside from the form) that I provide. I am writing a windows form class that supports full alpha blending. Basically I'm trying to make a layered window that supports controls. In order to do that I need to redirect painting of the...
8
281
by: Jim Butler | last post by:
Currently we are having to do an iisreset to update a gac component on a web server. Just removing it from the gac and re-adding it does not update the code executing on the server. This is not desirable. Is there anyway to force it out of memory (i am assuming this is the problem). We have multiple web sites that share the same...
1
6483
by: dd | last post by:
I have a situation where the browser memory goes up and up as each Ajax call causes new content to be deployed into a DIV. I'd like to know if I can force garbage collection to occur. More detail: My code is loaded in an iframe which is in a div. The parent page looks like this (my code is in firstiframe.html): <div id="main div">
10
2737
by: Daniel | last post by:
how to force a .net application to use .net 2.0 ? this windows service is about 4 years old and im pretty sure is using .net 1.x runtime. Is there soem setting in the installer that says to use .net 2.0 instead of .net 1.0? this windows service is developed in visual studio 2002
17
12610
by: M O J O | last post by:
Hi, How can I force a form to the foreground no matter what application is in front? Thanks! M O J O
5
2990
by: jehugaleahsa | last post by:
Hello: Is there a way to force a Dictionary to determine equivilence by memory location? I have a generic class where I don't want to treat equal items as identical items. Only when two references point to the same instance do I want to treat them as the same dictionary key. Any help?
0
7703
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5222
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.