Simon Brangwin
Simon Brangwin

Reputation: 858

How to derive a website absolute file path from a WCF service hosted in IIS?

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.

Upvotes: 3

Views: 1458

Answers (1)

Simon Brangwin
Simon Brangwin

Reputation: 858

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.

Upvotes: 5

Related Questions