2

Server.mappath is not working in wcf? what is the alternate way to get the physical location of the file in IIS.?

ankita sapkal
  • 21
  • 1
  • 3

1 Answers1

7

Best answered in this thread: How to get working path of a wcf application?

Basically, use this to get the working directory:

System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath
Community
  • 1
  • 1
Alex
  • 721
  • 6
  • 11
  • Do you know if this still works as of 2017? I can't find System.Web.Hosting in my references. – Dragomok Jan 10 '17 at 11:04
  • 1
    Perhaps you are not referencing System.Web? See http://stackoverflow.com/questions/26236721/cant-add-reference-to-system-web-hosting – Alex Jan 12 '17 at 19:32