IIS locks DLLs after deploying web site.

B

brianedow

I do not know why this happen, and it does not happen ALL the time, but
it does happen on a fairly regular basis, and when it does, it causes
real problems. If anyone can tell me
how to prevent this, and moreover, how to FIX it, without having to
bounce
IIS, I would REALLY appreciate it! This problem is occurring on IIS
Advanced Server 2003. Have not tested this on Server 2000. I am
guessing the same.

The Problem:

We deploy a work version of a .NET 2.0 web application. It works and
everything is okay. But then sudden, IIS / worker process fails to
load an assembly.

This is the error:
Could not load file or assembly '{My Assembly Name},
Version=1.0.0.20906, Culture=neutral, PublicKeyToken=null' or one of
its dependencies. Access is denied.

The file is stuck by IIS. I have tried to recycle the application pool
and that does not work. The only solution I have found so far is to
restart IIS and update the Assembly in the bin folder in order to force
a recompile. Please keep in mind I can update any of the other
Assemblies in the bin folder without any problem, it is only this one
file I can not update, thought restarting IIS. When I try, I get this
error ".....cannot access the file {My Assembly Name} because it is
being used by another process."

There is one thing that I have noticed: there is code where this
problematic assembly is being used / accessed using reflection. Now,
there are other assemblies also being accessed by reflection, but this
one so far has been the problem child. I tried FileMon to see who
might have the file locked and so far it has been the workerprocess
(w3wp.exe). I also seen others having this problem, but not real
solutions. I am at a loss.

Here is some of my research:
1.
http://groups.google.com/group/micr...eb3f4?lnk=st&q=&rnum=4&hl=en#7d8c7e0fcb2eb3f4
2.
http://www.velocityreviews.com/forums/t116973-releasing-a-loaded-assembly-in-aspnet-20.html
3. http://www.codecomments.com/archive289-2005-12-715366.html
4. http://www.eggheadcafe.com/forums/ForumPost.asp?ID=60661&INTID=7

How can I prevent this from happening in the first place? Any
thoughts? Thanks for your time.
 
B

brianedow

I am replying to my post, in order to share my finding. I think I have
find solution.

Thanks this post http://forums.asp.net/thread/1277349.aspx. THANKS
streelz!!

I was having this problem and found the following solution to work:

1. In IIS, click on web service extensions
2, Add a new web service extension (WSE)
3. Name the WSE "ASP.NET 2.0", or whatever you deem appropriate for
your enterprise
4. Add X:\your .net install path\framework\v2.0.50727\aspnet_isapi.dll
-- Install path is c:\windows\microsoft.net by default
5. Click OK, and set the WSE to "Allowed"
6. (optional) create a new application pool for your application
7. Right click your application and go to properties
8. On the ASP.NET tab, change the asp.net version to 2.0
9. Navigate to your x:\.net install path\framework\v2.0.50727 folder
10. Grant write/modify access to the"Temporary ASP.NET Files" folder
for your web user (IUSR, etc.)

I hope that helps others that are having this problem. MSFT should be
aware of this possible problem with ASP and .NET 2.0. I still think it
is a reflection related issue, but that is different topic. I will be
investigating that as-well to see how one can tell the worker process
to stop looking in the Temporary ASP.NET Files and looking for the dll
in the bin folder.

You can read another post which I have added additional comments.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=605591&SiteID=1&mode=1

I hope this helps people solve this VERY frustrating problem.
 

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