【发布时间】:2014-10-10 18:07:18
【问题描述】:
我正在处理 CRM 2013 中的自定义活动工作流。我的工作流访问一个 xml 文件。当我部署我的工作流程并运行它时,它会引发错误;
未处理的异常:Microsoft.Crm.CrmException:意外异常 从插件(执行):MyProj.WorkFlows.ReadXML: System.Security.SecurityException:请求类型的权限 'System.Security.Permissions.FileIOPermission, mscorlib, 版本=4.0.0.0,文化=中性,PublicKeyToken=b77a5c561934e089' 失败了。
我写的代码是这样的;
public string GetBookAuthor(string key, string bookId)
{
string fileName = @"books.xml";
XmlTextReader reader = new XmlTextReader(fileName);
XmlDocument doc = new XmlDocument();
doc.Load(reader);
reader.Close();
XmlNode bookAuthor;
if (doc != null)
{
XmlElement root = doc.DocumentElement;
if (root != null)
{
bookAuthor= root.SelectSingleNode("/books/book[@key='" + key + "']/Author[@bookId='" + bookId + "']");
if (bookAuthor!= null)
return bookAuthor.InnerText;
return string.Empty;
}
return string.Empty;
}
return string.Empty;
}
【问题讨论】:
标签: c#-4.0 dynamics-crm crm dynamics-crm-2013