开发者

WCF getting the phisical path of URL adress

开发者 https://www.devze.com 2023-04-04 12:07 出处:网络
I\'m new at WCF and i\'m trying to create a service, it needs to convert url to server path. For example开发者_如何学编程:

I'm new at WCF and i'm trying to create a service, it needs to convert url to server path. For example开发者_如何学编程: Gets -> "www.sample.com/client1" Returns -> "c://samplefolder/sampleproject/client1"

I'm trying this code:

string realPath = HostingEnvironment.MapPath(URL);

but I get The relative virtual path 'http://localhost:5353' is not allowed here

Does anyone knows what i'm doing wrong? Thanks


Try with the relative path. Instead of the url "http://www.sample.com/client1" use "~/client1" (the symbol '~' specifies the root folder of your application)

0

精彩评论

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