Hi, I'm moving webhosting provider. There are somethings I need to get accustomed to. I've setup a .svc service, in a webapplication (IIS6.0/W2003). I've finally achieved that a function is executed, this function reads a file. The function now comes into the catch block: catch (Exception e) { logger.ErrorException("function Error", e); logger.Error(String.Format("context: {0}", HttpContext.Current)); logger.Error(String.Format("server: {0}", HttpContext.Current.Server)); logger.Error(String.Format("file: {0}", HttpContext.Current.Server.MapPath(fileName))); } and this is the contents of the logfile: 2010-02-03 12:24:36.6747|ERROR|function Error 2010-02-03 12:24:36.6903|ERROR|context: So appearantly, HttpContext.Current is null. There is no web context. Anyone any ideas?
This is what I've found: http://msdn.microsoft.com/en-us/library/aa702682.aspx What to do now? Seems that "HostingEnvironment.Mappath" (which I was searching for) is the equivalent. For other operations use OperationContext.Current. Okay.
Appearantly, you use "OperationContext.Current" instead in WCF. To use Mappath, use "HostingEnvironment.Mappath".