3

How can one determine the absolute filepath of the WCF service root folder that's hosted in IIS?

I've investigated System.ServiceModel.OperationContext and discovered various relative URI paths, but no absolute paths that contain the service root folder.

Simon Brangwin
  • 858
  • 1
  • 7
  • 15

1 Answers1

5

After a little digging around the .NET framework I discovered:

System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath

This gets the physical path on disk to the application's directory, i.e. in the case of a WCF service hosted from IIS, the virtual folder's absolute file path.

Simon Brangwin
  • 858
  • 1
  • 7
  • 15