Getting IIS Application filesystem path

If you're using a console application project template or any other template other than Web application then you have to add a reference to System.Web.

You will then be able to refer to the System.Web.Hosting namespace.

Hope this helps!


try this might help to resolve your issue

string apPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;

or

string apPath = System.Web.Hosting.HostingEnvironment.MapPath("~/folder/file");