一:获取运行环境目录:如debugger     

var p= Path.Combine(AppContext.BaseDirectory, "upload").ToPath();

      var pc= Path.Combine(Environment.CurrentDirectory, "upload").ToPath();

      var ph= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "upload").ToPath();

      var ap= Path.Combine(Directory.GetCurrentDirectory(), "upload").ToPath();


二:获取指定应用目录

       var ps =Path.Combine(Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName).ToPath();