开发者

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 tried VirtualPathUtility.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")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜