How to resolve a relative Url in a WCF service?
I'm writing my first WCF service (as WCF application, that is hosted inside my IIS).
In the web.config I have an appSetting with an relative Url, like "~/images".
Inside the IIS I've created a virtual directory with the name "images". Works perfectly fine so far.From an ASP.Net point of view, I'm used to be able to resolve relative Urls into absolute Urls, to access the filesystem.
Howev开发者_开发技巧er, I currently can't seem to find a built-in way to convert a relative Url into an absolute Url.
How can I resolve "~/images" to the absolute path in a WCF service?
(I've already triedVirtualPathUtility.ToAbsolute
or tried to get a hold of a HttpContext, but that one does not exist in a wcf service according to my first google hits.Try
System.Web.Hosting.HostingEnvironment.MapPath("~/images")
精彩评论