获取服务器地址类型分多种,以下记录
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。
部署服务器:为部署文件所在磁盘文件夹;
如对本文有疑问, 点击进行留言回复!!
基于 API 网关 + 云函数 SCF 部署 Serverless 外卖订单系统
Sql Server数据库万能分页存储过程与C# API控制器调用
oracle 数据库 processes、sessions 的设置
网友评论