w3wp.exe locking DLL and PDB files.

Z

z. f.

Hi,

i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL.
for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it can't compile because the DLL is in use (and the PDB too), and the w3wp.exe process is the process locking the DLL (as viewed with Sysinternals - Process Explorer).
this is a huge problem. i need to do IIS reset in order to free the DLL!

1. why is the w3wp.exe process is locking a class library dll and not locking the asp.net DLL?
2. what will be in production environment, if i have to stop the web server in order to replace the DLL, it is unacceptable.
3. with asp-dot-net DLLs i only have to replace the DLL and the web server is updated. now with shared Class Library project I should have more problems?


please help it's urgent.

TIA, z.
 
W

wl

I assume you mean that the codebehind ASP.NET DLL is in use after the first time the DLL is triggered by requested the corresponding page from the IIS server ?
For performance reasons (amongst others), an ASP.NET DLL gets loaded the first time it is needed and it stays loaded.

You can unload (or change the way the loading is done) by using the "Internet Information Services" applet ("Application Protection" and "Unload")

Wim


Hi,

i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL.
for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it can't compile because the DLL is in use (and the PDB too), and the w3wp.exe process is the process locking the DLL (as viewed with Sysinternals - Process Explorer).
this is a huge problem. i need to do IIS reset in order to free the DLL!

1. why is the w3wp.exe process is locking a class library dll and not locking the asp.net DLL?
2. what will be in production environment, if i have to stop the web server in order to replace the DLL, it is unacceptable.
3. with asp-dot-net DLLs i only have to replace the DLL and the web server is updated. now with shared Class Library project I should have more problems?


please help it's urgent.

TIA, z.
 
Z

z. f.

i'm sorry to tell you that your response is not accurate.
first the IIS is not locking my aspnet DLL. i can replace it any time even if a minute ago i run a page that is using this DLL.
the IIS is locking a regular VB.NET DLL that is referenced and used by my aspnet DLL.
lets say i have a vb.net web application called mywebapp and is compiled to mywebapp.dll
and mywebapp is using a dll that is written as a class library project and is called util.dll
all projects are located on a development server (win2003) called devserver.

i use my browser to tun http://devserver/mywebapp/homepage.aspx
homepage.aspx codebehind is compiled into the mywebapp.dll and is using util.dll
if i make changes to util.dll project and want to compile it now, the dll is in use and can't be build again.
if i make changes to my homepage.aspx codebehind and compile it to mywebapp.dll - there is no problem.
this behavior is unaccepted and it is urgent for me to solve this.




I assume you mean that the codebehind ASP.NET DLL is in use after the first time the DLL is triggered by requested the corresponding page from the IIS server ?
For performance reasons (amongst others), an ASP.NET DLL gets loaded the first time it is needed and it stays loaded.

You can unload (or change the way the loading is done) by using the "Internet Information Services" applet ("Application Protection" and "Unload")

Wim


Hi,

i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL.
for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it can't compile because the DLL is in use (and the PDB too), and the w3wp.exe process is the process locking the DLL (as viewed with Sysinternals - Process Explorer).
this is a huge problem. i need to do IIS reset in order to free the DLL!

1. why is the w3wp.exe process is locking a class library dll and not locking the asp.net DLL?
2. what will be in production environment, if i have to stop the web server in order to replace the DLL, it is unacceptable.
3. with asp-dot-net DLLs i only have to replace the DLL and the web server is updated. now with shared Class Library project I should have more problems?


please help it's urgent.

TIA, z.
 
Z

z. f.

i don't use the GAC, but in order to solve the problem of DLL copies all around i use a codebase hint in the web.config of my web application. in order to do this i assign a strong name to the DLL and a fix version number.

should this cause any problem with locking the DLL differently from the default way?



I'm assuming your not using the GAC, right?
 
S

Scott Allen

Ah, yes. I believe ASP.NET will only shadow copy assemblies in the bin
directory. All other assebmlies are loaded into the process from the
original location and would be locked.
 
Z

z. f.

so if i put it in the GAC will it also be locked?
or is there an attribute in the configuration near the codebase hint to ask the framework to "Shadow" copy the DLL?


Ah, yes. I believe ASP.NET will only shadow copy assemblies in the bin
directory. All other assebmlies are loaded into the process from the
original location and would be locked.
 
S

Scott Allen

I have not tried this, but you might be able to modify the
ShadowCopyDirectories property of the appdomain to include your custom
path, ie:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


Again, I have not tried this, but let me know if you do or do not get
it working, I might investigate some more this evening.
 
S

Scott Allen

Of course this would have to happen before the web app tries to load
the assembly....
 
Z

z. f.

thanx, you just made my day!

Of course this would have to happen before the web app tries to load
the assembly....
 
Z

z. f.

well,
iti works fine most of the time, but i still sometimes have to recycle the IIS because the DLL is in use, and i just can't figure out where or why it does that.




Of course this would have to happen before the web app tries to load
the assembly....
 
S

Scott Allen

Interesting. Using FileMon
(http://www.sysinternals.com/ntw2k/source/filemon.shtml)
you could see the exact instance when the .dll is touched. Perhaps it
gets loaded before the shadow copy path is set.

--
Scott
http://www.OdeToCode.com/blogs/scott/


well,
iti works fine most of the time, but i still sometimes have to recycle the IIS because the DLL is in use, and i just can't figure out where or why it does that.




Of course this would have to happen before the web app tries to load
the assembly....

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have not tried this, but you might be able to modify the
ShadowCopyDirectories property of the appdomain to include your custom
path, ie:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


Again, I have not tried this, but let me know if you do or do not get
it working, I might investigate some more this evening.
 
Z

z. f.

i think it was because of a copy of the DLL in the other project bin directory. i removed it and now it seems to work fine.

Interesting. Using FileMon
(http://www.sysinternals.com/ntw2k/source/filemon.shtml)
you could see the exact instance when the .dll is touched. Perhaps it
gets loaded before the shadow copy path is set.

--
Scott
http://www.OdeToCode.com/blogs/scott/


well,
iti works fine most of the time, but i still sometimes have to recycle the IIS because the DLL is in use, and i just can't figure out where or why it does that.




Of course this would have to happen before the web app tries to load
the assembly....

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have not tried this, but you might be able to modify the
ShadowCopyDirectories property of the appdomain to include your custom
path, ie:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


Again, I have not tried this, but let me know if you do or do not get
it working, I might investigate some more this evening.
 
Z

z. f.

to add note when i call SetShadowCopyPath in me PageLoad event and in this event there is also a call to a function in the DLL itself, it will not help, the DLL will get loaded to the default location and locked.
in this case i put it in the Page_Init and it works.
probably the framework loads the dll upon entering the method call that uses the DLL and not at the point in the code where it's required.


i think it was because of a copy of the DLL in the other project bin directory. i removed it and now it seems to work fine.

Interesting. Using FileMon
(http://www.sysinternals.com/ntw2k/source/filemon.shtml)
you could see the exact instance when the .dll is touched. Perhaps it
gets loaded before the shadow copy path is set.

--
Scott
http://www.OdeToCode.com/blogs/scott/


well,
iti works fine most of the time, but i still sometimes have to recycle the IIS because the DLL is in use, and i just can't figure out where or why it does that.




Of course this would have to happen before the web app tries to load
the assembly....

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have not tried this, but you might be able to modify the
ShadowCopyDirectories property of the appdomain to include your custom
path, ie:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


Again, I have not tried this, but let me know if you do or do not get
it working, I might investigate some more this evening.
 
Z

z. f.

one thing that does happend now, is that if the copy of the DLL is loaded and i compile the DLL, sometimes, of-course i can't tell exactly when, the framework does not load the new DLL at all.

i double checked again. there is no copy of the DLL in the bin directory.
i run the page, DLL gets loaded, changes the DLL, re-run the page - it's the same as before.
no indication for change in the external DLL.

process explorer shows a DLL reference in the w3wp.exe for the path:

C:\WINDOWS\microsoft.net\framework\v1.1.4322\temporary asp.net files\mall\6f882979\3791053f\assembly\dl2\ca3073b7\0e196d1a_75d8c401

with time stamp of 7 minutes ago, even though the current DLL in updated to the current time!

what can i do???








to add note when i call SetShadowCopyPath in me PageLoad event and in this event there is also a call to a function in the DLL itself, it will not help, the DLL will get loaded to the default location and locked.
in this case i put it in the Page_Init and it works.
probably the framework loads the dll upon entering the method call that uses the DLL and not at the point in the code where it's required.


i think it was because of a copy of the DLL in the other project bin directory. i removed it and now it seems to work fine.

Interesting. Using FileMon
(http://www.sysinternals.com/ntw2k/source/filemon.shtml)
you could see the exact instance when the .dll is touched. Perhaps it
gets loaded before the shadow copy path is set.

--
Scott
http://www.OdeToCode.com/blogs/scott/


well,
iti works fine most of the time, but i still sometimes have to recycle the IIS because the DLL is in use, and i just can't figure out where or why it does that.




Of course this would have to happen before the web app tries to load
the assembly....

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have not tried this, but you might be able to modify the
ShadowCopyDirectories property of the appdomain to include your custom
path, ie:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


Again, I have not tried this, but let me know if you do or do not get
it working, I might investigate some more this evening.
 
Z

z. f.

the funny (or not) thing about it is that if i had a throw new exception ("asdasdas") in the external DLL, and i removed it, i get the exception thrown and the source details doesnot include this line since the udated PDB reflects the updated source, but the compiled DLL not.

anyway, i will open a new post regarding this, because it's urgent to solve and there nothing i can do about it.


one thing that does happend now, is that if the copy of the DLL is loaded and i compile the DLL, sometimes, of-course i can't tell exactly when, the framework does not load the new DLL at all.

i double checked again. there is no copy of the DLL in the bin directory.
i run the page, DLL gets loaded, changes the DLL, re-run the page - it's the same as before.
no indication for change in the external DLL.

process explorer shows a DLL reference in the w3wp.exe for the path:

C:\WINDOWS\microsoft.net\framework\v1.1.4322\temporary asp.net files\mall\6f882979\3791053f\assembly\dl2\ca3073b7\0e196d1a_75d8c401

with time stamp of 7 minutes ago, even though the current DLL in updated to the current time!

what can i do???








to add note when i call SetShadowCopyPath in me PageLoad event and in this event there is also a call to a function in the DLL itself, it will not help, the DLL will get loaded to the default location and locked.
in this case i put it in the Page_Init and it works.
probably the framework loads the dll upon entering the method call that uses the DLL and not at the point in the code where it's required.


i think it was because of a copy of the DLL in the other project bin directory. i removed it and now it seems to work fine.

Interesting. Using FileMon
(http://www.sysinternals.com/ntw2k/source/filemon.shtml)
you could see the exact instance when the .dll is touched. Perhaps it
gets loaded before the shadow copy path is set.

--
Scott
http://www.OdeToCode.com/blogs/scott/


well,
iti works fine most of the time, but i still sometimes have to recycle the IIS because the DLL is in use, and i just can't figure out where or why it does that.




Of course this would have to happen before the web app tries to load
the assembly....

--
Scott
http://www.OdeToCode.com/blogs/scott/

I have not tried this, but you might be able to modify the
ShadowCopyDirectories property of the appdomain to include your custom
path, ie:

AppDomain.CurrentDomain.SetShadowCopyPath(
AppDomain.CurrentDomain.SetupInformation.ShadowCopyDirectories +
";" +
"[CustomPath]"
);


Again, I have not tried this, but let me know if you do or do not get
it working, I might investigate some more this evening.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top