Server.MapPath()
returns an error as the HttpContext is null due to running under another thread.To work around this problem you can use the method:
System.Web.Hosting.HostingEnvironment.MapPath()
Server.MapPath()
returns an error as the HttpContext is null due to running under another thread.System.Web.Hosting.HostingEnvironment.MapPath()