我构建了一个工具来处理控制器部分中的windows local appdata文件夹中的文件,并且该工具在本地运行时工作正常....我在Azure Web服务应用程序上部署了此站点,我无法获取文件。是否需要设置任何设置来获取appdata文件夹/权限?
我获取本地文件夹的代码:
[HttpPost]
public void FetchTheFile(String FilterVariables)
{
Request.InputStream.Seek(0, SeekOrigin.Begin);
StreamReader sr = new StreamReader(Request.InputStream);
string srrr = sr.ReadToEnd();
var settings = new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore };
FilterVariables FV = JsonConvert.DeserializeObject<FilterVariables>(srrr, settings);
try
{
//Deserialize();
string appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
string filePath = Path.Combine(appDataFolder, "CRM\\Logs\\Outlook.log");
if (System.IO.File.Exists(filePath))
{
Stream stream = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
StreamReader streamReader = new StreamReader(stream);
str = streamReader.ReadToEnd();
str = "<?xml version=\"1.0\" encoding=\"utf - 8\"?><LOGS>" + str + "</LOGS>";
str = Regex.Replace(str, @"[\u0000-\u001F]", string.Empty);
XmlSerializer serializer = new XmlSerializer(typeof(Models.LOGS));
Models.LOGS logs = new Models.LOGS();
StringReader strReader = new StringReader(str);
XmlTextReader xmlReader = new XmlTextReader(strReader);