I’m having problems with impersonation in WCF. Namely, I’m calling a named pipe service from within ASP.NET with impersonation turned on. This fails (due to permissions on the pipe blocking anyone from the network). So, is there any way I can make the call outside of the impersonation context? I don’t need to be impersonating to make this call, but can’t see any way of doing this.
Anyone got any ideas?
Thanks
Matt
PS. I need to do this declaratively, through config…
I was lucky enough that the service I needed to disable impersonation on was on an IIS endpoint that no-one else was using, and I could quite happily change the authentication/authorisation parameters in the web.config so that access was granted to anonymous users. Not a fix, but a work around.
As far as I can tell, if I wanted to do this in code, I would wrap my client in a call to WindowsIdentity.Impersonate(IntPtr.Zero), which is apparently the same as calling the Win32 RevertToSelf. I don’t know what happens when this context is disposed, though (does the undo re-impersonate the originally impersonated user? Or has the revert stuck?)