Jamo Jamo - 1 year ago 86
C# Question

Required user for ThreadPool.QueueUserWorkItem

Maybe this question doesn't go here....

I am using

to write a folder/file, my problem is when it tries to write I got

So I changed the directory to grant everyone to write and it works.

But I don't want to grant everyone to write. It seems is a different user/group that the
uses than the main thread.

What user should it be?

Answer Source

Because it is a IIS application the user you have to grant rights to is the user the application pool runs under.

Your main thread is likey impersonating the user that the request is for. The background work item is nolonger associated with the user.

PS: using ThreadPool.QueueBackgroundWorkItem in IIS is a very bad idea, you need to use a more appropriate tool for background work in IIS.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download