Assembly.LoadFile() causes file locking

  • Thread starter Thread starter PyD
  • Start date Start date
P

PyD

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 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. =)
 
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

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. =)
 
Back
Top