Assembly.LoadFile() causes file locking

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

Henning Krause [MVP - Exchange]

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top