获取服务器地址类型分多种,以下记录
1、httpcontext.current.server.mappath(“~/file”)
返回的值为 d:\3project\code\mobileservice\webapi\file。
本地服务:此路径为项目所在磁盘地址根目录。
部署服务器:为部署文件所在磁盘文件夹;
2、system.web.hosting.hostingenvironment.mappath(“/file/”)
返回值为d:\3project\code\mobileservice\webapi\file。
服务器:c:\inetpub\wwwroot\file\微信图片_20180814161310.pdf
3、system.appdomain.currentdomain.basedirectory
返回的值为 d:\3project\code\mobileservice\webapi\file。
本地服务:d:\3project\code\mobileservice\webapi\file。
部署服务器:为部署文件所在磁盘文件夹;
黄山市民网:https://www.huangshanshimin.com/