开发者

How to resolve a relative Url in a WCF service?

开发者 https://www.devze.com 2023-03-28 13:53 出处:网络
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\".

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

精彩评论

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