Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

Trouble deleting file from server - IIS Worker Process the culprit

In my web application, I am trying to delete a file from the server and it says permission denied, using: Scripting.FileSystemObject
   fs.DeleteFile(filename),True

in IIS I have the Anonymous User Identity set to the Application Pool Identity.

The folder for the files has granted full advanced permissions, including delete, for these users:
IUSR
IIS_IUSRS
DefaultAppPool

Once I set the settings on the folder and propagate all via replace all child object permissions...

I can delete an existing file.
Then I upload a new one.
Then I replace the new one.
Then I delete the new one. And I get the error.

So I went to the server itself and selected the file in the file directory and tried to delete and get this error:
The action can't be completed because the file is open in IIS Worker Process
Close the file and try again

What is the IIS Worker Process of which we speak and why is it doing it and how can I get it to stop doing it?

This is inconsistent and sometimes no problems, but sometimes yes a problem (about 50% maybe).

I saw a message that said "you must stop the worker process." I can't be running to my server and stopping a process every time a user wants to reupload or delete a file. So what is the solution?

This is a windows 2012 R2 web server.
Please help.

thanks
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

I would recommend creating and using a custom account for the AppPool instead of using the default identity options.

If you are uncomfortable with using a domain based service account, use a local account instead.  Insert the account into the IIS_IURS group and test.

As for the worker process, that is the w3wp.exe which is the AppPool.  Its probably holding a lock on the file because of the delete request, subsequent access denied error and probably the fact that there is no error handling being done in the VBScript.

Dan
Avatar of Starr Duskk

ASKER

Sorry my bad.

I have two websites. One was setup for AppPool as indicated in my message. The other one I setup the anonymous user as the IUSR, and permission on folder for that. Then tried the IIS_IUSRS because someone said asp classic required that and it still didn't work. So the other website, I setup using AppPool so I could test both ways.

But I also have an asp.net website with same problems.

I did have error handling in the vbscript, but handling the error and displaying a message to the screen is not fixing the problem. I need a fix.

The Worker Process error only occurs when I try to delete directly from the server.

Thanks for your recommendations on using another user, but I've done that, am doing that, same problem. I was just trying to explain the problem briefly without all the details as to what all I've tried.

I need to know how to fix this and get it to release the lock so I can delete it.

thanks!
Do you have ASP.NET Impersonation enabled for the .NET app?

Reference:  https://msdn.microsoft.com/en-us/library/xh507fc5(v=vs.100).aspx

Also, can you post the full error message?

Dan
ASKER CERTIFIED SOLUTION
Avatar of Dan McFadden
Dan McFadden
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks!