I have created a WCF RESTFul webservice by following
http://msdn.microsoft.com/en-us/library/dd203052.aspx. I am hosting my RESTful webservice in a window service (and not IIS) using the WebServiceHost class.
Now I am struggling to get user's windows credentials in my web service methods. I looked at various code samples in forums for this. Almost all of them are hosting the service in IIS plus configuring the service's
settings using <system.serviceModel> tag.
I don't want to host my service in IIS plus as of now I haven't overridden any EndPoints, Behaviours etc in .config file.
I tried with below code in my window service's onstart method
WebServiceHost host = new WebServiceHost(typeof(MyService), new Uri(_serviceUrl));
ServiceAuthorizationBehavior myServiceBehavior = host.Description.Behaviors.Find<ServiceAuthorizationBehavior>();
myServiceBehavior.PrincipalPermissionMode = PrincipalPermissionMode.UseWindowsGroups;
After putting above code I queried ServiceSecurityContext.Current and System.Threading.Thread.CurrentPrincipal my RESTFul's method but they are showing no sign of return
View Complete Post