Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 DLL Access Denied error

Author  Topic 

skitrees
Starting Member

4 Posts

Posted - 2005-01-28 : 23:24:39
Hi,

I'm totally new to VB.NET (I know this is ASP.NET) but I have a question and wonder if someone here could help me or direct me to a location I might find an answer to the following dilema. . .

A gentleman I work with has created a basic DLL app that he calls from his default.htm (this can be any DLL - something that even just is "Hello World" - doesn't matter).

Let's call this dll "DLLTest.dll" for demonstrative purposes.

He needs to automate changes to this file. The way we had proposed was to simply have him copy the "new" version of DLLTest.dll to the server, but instead of calling it DLLTest.dll - call it DLLTest.update. Then, the software I created monitors for the existence of DLLTest.update - if it exists then it renames the original DLLTest.dll to DLLTest.old, and renames the DLLTest.update to DLLTest.dll (thus replacing the original with the updated version.) This works great - unless I have launched the default.htm which calls the DLL. If I HAVE already launched the default.htm file - I receive an ACCESS DENIED error when my application attempts to rename the DLLTest.dll - even if I stop IIS and have set the Local_Machine\Software\Microsoft\CurrentVersion\Explorer\AlwaysUnloadDLL value to 1 (or whatever the path was). I even ensure that all users have closed their browser pages - yet I still receive the error.

Now - if I simply browse to the folder via "My Computer" - it will allow me to manually rename the DLLTest.dll file, but it WON'T allow me to delete it.

I've given write privileges (FULL CONTROL) to the EVERYONE group during testing, and I still receive the same error.

Any suggestions? I've never worked with DLLs before, so I would appreciate any info at all.

I apologize if this has been confusing, and welcome any and all questions. If I can provide further information or clarity on anything stated above - I would be eager to do so if it will help get things going.

Thanks again!!
skitrees

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2005-01-29 : 00:21:59
i believe you have to restart the web server (IIS) before you can change the dll. The service 'locks' the dll once its been referenced once.

Corey

"If the only tool you have is a hammer, the whole world looks like a nail." - Mark Twain
Go to Top of Page

skitrees
Starting Member

4 Posts

Posted - 2005-01-29 : 02:14:19
Wowzers!!!!!

Seventhnight. . .thank you so much for your quick response. I hadn't been able to find anything about this on the net because I kept searching for "unload DLL" or "locked DLL" - yet the DLL never reported being locked - so I was really stuck.

Your suggestion was right on the mark - I ended up being able to filter it down to a specific service:

"World Wide Web Publishing Service"

I restart it, and everything works perfectly.

Thanks - this has made my day!! Your help is greatly appreciated!!

Thanks Again,
Skitrees
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2005-01-29 : 06:31:44
>>i believe you have to restart the web server (IIS) before you can change the dll. The service 'locks' the dll once its been referenced once.

Hmmm. Seems to smack in the face of XCopy:
quote:
An Xcopy-style file transfer simplifies the deployment and the maintenance of .NET apps because you make no registry entries and because you register no components. The Microsoft .NET applications are self-describing, typically with no dependencies. With assembly versioning, you can even copy a new copy of a DLL that the application uses without stopping the Web server.
Go to Top of Page

skitrees
Starting Member

4 Posts

Posted - 2005-01-29 : 11:40:54
Touche! (grin)
Go to Top of Page

saglamtimur
Yak Posting Veteran

91 Posts

Posted - 2005-01-29 : 15:28:26
One other solution is, register your dll via COM+ Services. In this way you dont need to restart web server each time you update your dll. Have a look at this link, it will show you how to achive this.

http://www.iisfaq.com/Default.aspx?tabid=2966

Its written for Windows 2000 Server but same for 2003 server.
Go to Top of Page

skitrees
Starting Member

4 Posts

Posted - 2005-01-29 : 19:02:31
saglamtimur,

Cool - that is a GREAT solution. Do you know of any downsides to it? This solution seems to be much better for what I am trying to do. (The other solution is working well too, but it would be nice to not restart the service).

Thanks for the link - I like what I've read!

Thanks again
Go to Top of Page

saglamtimur
Yak Posting Veteran

91 Posts

Posted - 2005-01-30 : 06:58:00
I dont know if there is any downsides. I am new to it, and for my case its the only solution, so I use it and I am happy.
Go to Top of Page
   

- Advertisement -