ahmd0
ahmd0

Reputation: 17293

Get path to installed IIS web application from a C# local service

I have two projects developed with C#, .NET in VS 2010: One is an ASP.NET web application and the second one is a C# Windows service that runs as a local system. The web application is installed and run on the same physical machine via IIS.

My question is, how to get the path to my web application installation folder on this machine from the service?

Upvotes: 0

Views: 890

Answers (1)

Alexandr Mihalciuc
Alexandr Mihalciuc

Reputation: 2577

I assume your are using IIS 7.5 and you know web application name. If so you can use ServerManager from Microsoft.Web.Administration assembly to get the physical path.

Here is link on how to user the class ServerManager How to get site's physical path on disk?

Upvotes: 1

Related Questions