Mostafa Mostafa - 1 year ago 61
C# Question

User and permission issue in ASP.NET Thread Timer

I use a Thread Timer for Background task scheduling in my ASP.NET MVC projects.

In one of those tasks , I connect to active directory for some actions like moving users in OU's and adding and removing security groups.

When I launch my application in VS 2013 on IIS Express , It work fine , But When I host my app on IIS of that machine although it has the exact same credential , I get

Access Denied
error .

My question is what's the credential difference between running app in VS ( Which use IIS Express ) and running on IIS 7.5 and how can I solve this issue .

Answer Source

IIS Express usually runs through your own user, which is probably an Administrator and has all the necessary roles.

IIS 7.5 runs as a service, therefore, it uses built-in user accounts which probably lacks the permissions you need.

Here's how you change an AppPool identity on IIS 7.5: