我有一个文件,用户浏览并点击上传按钮,我将文件保存在服务器上,appdata/uploads 在应用程序目录中。然后我尝试使用流阅读器读取它,然后解析它。在我的本地开发环境中它工作正常,但是当我将它部署在服务器上时它根本不起作用。有什么建议么??谢谢你
//Save LoadList File:
DateTime uploadDate = DateTime.Now;
string destinationPath = string.Format("{0}\\{1}\\{2}\\{3}\\", Server.MapPath("~/App_Data/uploads"), uploadDate.ToString("yyyy"), uploadDate.ToString("MMM"), uploadDate.ToString("dd"));
if (!Directory.Exists(destinationPath))
Directory.CreateDirectory(destinationPath);
string storedFileName = string.Format("{0}{1}.json", destinationPath, System.Guid.NewGuid());
file.ElementAt(0).SaveAs(storedFileName);
//FileImport is a static class
var Pair = FileImport.CyclesCompleted(storedFileName);
private static string LoadTextFromFile(string fileName)
{
StreamReader streamReader = new StreamReader(fileName);
string text = streamReader.ReadToEnd();
streamReader.Close();
return text;
}