Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a listener that processes emails in the inetpub/mailroot/Queue directory. Once the listener is done processing an email it proceeds to move the email to another directory. However, moving the email is not possible due to a file lock by the process inetinfo.exe. I have noticed that this file lock is released after a period time that ranges from several hours to several days. You can see that the Queue directory can get pretty full over time.

The only way I have been able to work around this is by manually stopping and starting my SMTP virtual server in IIS.

Is it possible to release this file lock programmatically? If not, is it possible to expedite releasing this file lock?


The listener monitors the Queue folder for incoming emails and then processes them. Data from the emails is then inserted into an internal program of ours. After the listener is done with the email it moves the email to a success or fail directory elsewhere.


After coming back to this problem almost a year later I was finally able to solve it! The solution was to configure the SMTP Virtual Server's local (default) domain and set it to the appropriate domain of the emails I wanted to process. This caused emails to go into the Drop folder where they could be freely manipulated without having to worry about process locks.

share|improve this question
up vote 2 down vote accepted

The "Queue" directory is meant for internal use by the SMTP server process. You're finding files locked there because you're not supposed to be working with them there. If your "Queue" directory is filling up then you'd be best-served to figure out why email deliveries are failing. It's unclear to me if the old SMTPDiag tool from Microsoft might work on Windows Server 2008, but it would be a place to start.


It's unclear to me exactly what you're trying to do with your processing task. The "Queue" folder is used to hold messages that are pending delivery. Messages that have are accepted for local delivery are stored in the "Drop" folder. Assuming you're looking for messages that are being accepted for local delivery I'd be concerned about why they're hanging out in "Queue" and not ending up in "Drop". There shouldn't be files building up in "Queue" unless something isn't working right.

(As an aside: Finding documentation re: the SMTP Service in Windows Server 2008 is turning out to be pretty difficult. The SMTP Service always has been a bit of an orphan, living in a netherworld between the Windows OS and Exchange. >sigh<)

share|improve this answer
If I'm not supposed to work with files in the Queue directory, then which directory am I supposed to be using? – Bryan Roth Jul 11 '12 at 21:47
@BryanRoth: I dropped on an edit, FWIW. – Evan Anderson Jul 13 '12 at 0:17
Thanks for the update. There isn't any local emails to be handled so the Drop folder is not used. I've updated my question to have more details to maybe help out in solving this problem. – Bryan Roth Jul 17 '12 at 3:55

there are some parameters in the registry to control the lock timings...

but to keep it easy...

Just restart IIS (as as scheduled task every 'n' minutes), if you are using IIS 7.0 do it this way...

// stop iis and other web services
net stop WAS

( pause a few seconds, +30s )
>>> Do your processing... files should be released now...

// start iis and web services
net start W3SVC
share|improve this answer
I'm not sure if restarting IIS via a scheduled task is a good idea. There has to be a better way. However, thanks for the tip on looking into the registry. – Bryan Roth Jul 11 '12 at 21:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.