Giardino
Giardino

Reputation: 1387

What user does WCF use to write?

I currently have a WCF service that allows the client to upload an image to the server. The service then saves that image to the server's C drive as a test. This works, but I am curious as to why it works.

I was under the impression that the service was always executed as the IIS user, meaning that it would be stuck with whatever permissions the IIS user had at the time of execution. However, the folder that I am uploading to on the C drive does not list a permission for the IIS user at all. The only folder that has a permission for that user is that folder that actually contains the service and even then its only to read & execute.

So my question is, how is the service able to write to the C drive of the server when it is being run as a user with no security access for that directory?

Upvotes: 1

Views: 85

Answers (1)

Wiktor Zychla
Wiktor Zychla

Reputation: 48279

If the WCF service is hosted in IIS then the actual code doesn't run under the IUSR user, rather it runs under the account you set for this particular application pool.

You can check the identity easily, just set up a simplest ASPX web page and paste this into the page's file

<%@ Page Language="C#" %>

Current user: <%= System.Security.Principal.WindowsIdentity.GetCurrent().Name %>

http://www.wiktorzychla.com/2010/09/identity-of-application-pool-in-iis.html

Upvotes: 3

Related Questions