6/25/2010 2:38:21 PM
Posted by: Tim Stanley
When running a service under IIS, the HttpContext.Current object is not available, so HttpContext.Current.Server.MapPath will fail. fileName = HttpContext.Current.Server.MapPath(fileName);
The solution is to use Hosting.HostingEnvironment.MapPath instead.
fileName = System.Web.Hosting.HostingEnvironment.MapPath(fileName);