标签:
一.在WCF中获取当前服务发布目录的绝对路径
1.string a = System.Web.Hosting.HostingEnvironment.MapPath("~");
当没有开启ASP.NET相容模式时(aspNetCompatibilityEnabled="true"),WCF不支持HttpContext, HttpApplication,会报HttpContext.Current == null发生错误,开启aspNetCompatibilityEnabled="true"时就没有问题了。
2.string b = System.Web.HttpContext.Current.Server.MapPath("~")
标签:
原文地址:http://www.cnblogs.com/AndyCf/p/4977055.html