【发布时间】:2015-06-26 03:33:57
【问题描述】:
我正在开发一个应用程序,其中多个用户在处理过程中更新 xsl。此文件放置在部署 Web 应用程序的服务器上的文件夹中。
以下代码用于更新 xsl 文件。
XmlDocument doc = new XmlDocument();
doc.Load(ConfigurationManager.AppSettings["XSLPdfDimensions"]);
XmlNode root = doc.DocumentElement;
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform");
root.SelectSingleNode(marginTop, nsmgr).Attributes["select"].Value = Convert.ToString(top);
root.SelectSingleNode(marginBottom, nsmgr).Attributes["select"].Value = Convert.ToString(bottom);
doc.Save(ConfigurationManager.AppSettings["XSLPdfDimensions"]);
当用户同时访问该文件时出现异常
"The process cannot access the file 'C:\XSL\Dimensions.xsl'because it is being used by another process"
如何通过最小化功能延迟来解决这个问题,或者有一些替代方法来更新 xsl 文件?
【问题讨论】:
标签: c# asp.net xml xslt xmldocument