System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath is a good bet for determining the local path for a WCF service. If you have to test whether you are IN a WCF service, then you want to do a nullity test on System.ServiceModel.OperationContext.Current. If it is not null, you're running under WCF.