Server.Mappath和调用webproject [英] Server.Mappath and calling webproject

查看:69
本文介绍了Server.Mappath和调用webproject的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在解决方案"TestSolution"中有一个Web服务项目A,并且A.FileConverter()是服务方法.

I have a web service project A in a solution "TestSolution" and A.FileConverter() is the service method.

FileConverter(string Url)
{
Uri myUri = new Uri(Url);
string path = Server.Mappath(myUri.AbsoluteUrl);
}



如果我在同一解决方案中从另一个项目(例如B)调用此服务,则Server.Mappath()是否有任何方法可以返回项目B的路径?

现在,如果我已经创建了服务类的实例,则它总是引用Web服务项目的相对路径,而不是引用该项目的相对路径.



If I am calling this service from another project (say B) in the same solution, is there any way that the Server.Mappath() will return path of the project B?

Now if I have created an instance of the service class, it is always referring to the relative path of the web service project and not to the project from which it is called

推荐答案

否.该Web服务位于单独的Web应用程序中,因此Server.MapPath是相对于其的空间,而不是调用方的空间.
No. The web service is in a separate web application and as such Server.MapPath is relative it''s space not to the callers.


这篇关于Server.Mappath和调用webproject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆