Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Error: "Access is denied HRESULT: 0x80070005 (E_ACCESSDENIED)" when connecting to remote server from IIS 7.

$
0
0
Hi

I am trying to retrieve scheduled tasks from our remote server, but i'm getting an "Access is denied" exception.
I am trying to access the tasks from a website on IIS 7 on Windows Server 2008.

I have tried the following:
1) Plain
var ts = new TaskService("RemoteServerName");
2) Use impersonation
var identity = HttpContext.Current.Request.LogonUserIdentity;
WindowsImpersonationContext impersonation = identity.Impersonate();

var ts = new TaskService("RemoteServerName");

impersonation.Undo();
  • The exception occurs when trying to initialize a new TaskService.
  • When trying to access the scheduled tasks on the local server (the server where the website is hosted) I get no errors, but can only retrieve all tasks if I use impersonation.
  • If I test the same code in the Visual Studio (and IIS Express), it works fine (even without impersonation).
I tried to monitor the Event viewer -> Windows Logs -> Security on the RemoteServer when executing the code. I noticed that the accountname is "ANONYMOUS LOGON" when executing from IIS7 (even when using impersonation).

Why is impersonation ignored?

Viewing all articles
Browse latest Browse all 2206

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>