How do I get the current directory in a web service

前端 未结 7 860
情歌与酒
情歌与酒 2020-12-09 08:04

I am using System.IO.Directory.GetCurrentDirectory() to get the current directory in my web service, but that does not give me the current directory. How do I get the curren

7条回答
  •  忘掉有多难
    2020-12-09 08:35

    HttpContext.Current.Server.MapPath(".") will give you the current working directory.

    But to Rohan West's comment about potentially being outside of an HttpContext it would probably be better to just call:

    HostingEnvironment.MapPath(".")
    

    See details here

提交回复
热议问题