web api record deployment type IIS server to obtain addresses

Get the server address a variety of sub-types, the following records

1、HttpContext.Current.Server.MapPath("~/File")

Returned value D: \ 3Project \ Code \ MobileService \ WebApi \ File.

Local Service: This path is where the project addresses the root directory of the disk.

Deployment Server: the deployment of the disk where the file folders;

2、System.Web.Hosting.HostingEnvironment.MapPath("/File/")

Returns a value of D: \ 3Project \ Code \ MobileService \ WebApi \ File.

Server: C: \ inetpub \ wwwroot \ File \ micro letter picture _20180814161310.pdf

3、System.AppDomain.CurrentDomain.BaseDirectory

Returned value D: \ 3Project \ Code \ MobileService \ WebApi \ File.

Local service: D: \ 3Project \ Code \ MobileService \ WebApi \ File.

Deployment Server: the deployment of the disk where the file folders;

 

Guess you like

Origin www.cnblogs.com/ps903942560/p/11698836.html