.net Core 获取网站目录

就一句话

 var path = AppContext.BaseDirectory;

生成文件就几句话

StreamWriter sw = new StreamWriter(path + "123.json");
sw.Write("hahhaha");
sw.Close();
原文地址:https://www.cnblogs.com/Extnet/p/9916005.html