[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Assembly.LoadFile() causes file locking

Jared

11/14/2008 6:25:00 PM

I have a web service running in IIS that uses Assembly.LoadFile() to
load a specific DLL, depending on who is making the web service
request. This works fine except that IIS places a lock on the DLL,
preventing me from updating it without bouncing the web server
process, which negatively affects other sites on the server.

I'd like to be able to update these DLLs without having to restart
IIS.

Is there a way to load an assembly at runtime without locking it, or
can I release the lock somehow? Is there a way to use the GAC for
this purpose?

Thanks in advance!
2 Answers

Jared

11/14/2008 10:00:00 PM

0

On Nov 14, 10:24 am, PyD <blacktoe.the.cripp...@gmail.com> wrote:
> I have a web service running in IIS that uses Assembly.LoadFile() to
> load a specific DLL, depending on who is making the web service
> request.  This works fine except that IIS places a lock on the DLL,
> preventing me from updating it without bouncing the web server
> process, which negatively affects other sites on the server.
>
> I'd like to be able to update these DLLs without having to restart
> IIS.
>
> Is there a way to load an assembly at runtime without locking it, or
> can I release the lock somehow?  Is there a way to use the GAC for
> this purpose?
>
> Thanks in advance!

I was able to get around the file locking issue by reading the DLL
into memory and loading the assembly from there. However, it appears
IIS never releases the assembly because its memory usage continues to
climb with every call to the web service.

I feel like I'm missing something simple here. =)

Henning Krause [MVP - Exchange]

11/15/2008 4:02:00 PM

0

Hi,

you simply cannot unload an assembly from an appdomain once you have loaded
it. If you need to unload assemblies, load them in different AppDomains.

Kind regards,
Henning

"PyD" <blacktoe.the.crippler@gmail.com> wrote in message
news:9bfe714f-d743-4168-83a7-a969b0b5c447@q30g2000prq.googlegroups.com...
On Nov 14, 10:24 am, PyD <blacktoe.the.cripp...@gmail.com> wrote:
> I have a web service running in IIS that uses Assembly.LoadFile() to
> load a specific DLL, depending on who is making the web service
> request. This works fine except that IIS places a lock on the DLL,
> preventing me from updating it without bouncing the web server
> process, which negatively affects other sites on the server.
>
> I'd like to be able to update these DLLs without having to restart
> IIS.
>
> Is there a way to load an assembly at runtime without locking it, or
> can I release the lock somehow? Is there a way to use the GAC for
> this purpose?
>
> Thanks in advance!

I was able to get around the file locking issue by reading the DLL
into memory and loading the assembly from there. However, it appears
IIS never releases the assembly because its memory usage continues to
climb with every call to the web service.

I feel like I'm missing something simple here. =)