当我试图从一个XML文件中读取,当我尝试使用加载它的XmlDocument
我得到这个错误处理请求错误: The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
服务器无法加载XML文件
下面是导致此代码:
public string calorieCount(int choice)
{
string calCount = "250";
XmlDocument doc = new XmlDocument();
//ERROR WITH LINE BELOW. no error without.
doc.LoadXml("XMLFile1.xml");
//XmlElement root = doc.DocumentElement;
//XmlNode node = doc.SelectSingleNode("/menu/item[@name='Burger']/calories");
//string checker = node.Value;
//MessageBox.Show(checker);
return calCount;
}
看起来好像不管我放在哪里的路径都行不通。有任何想法吗?
编辑 我做了以下错误仍然存在,我已经更新了服务的参考,它仍然给了我这个错误。
<behavior name="debug">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
和
<services>
<service name="calorieCount" behaviorConfiguration="debug"></service>
</services>
我已经试过这一点,但什么也没有发生 – Andy
你有没有回收的应用程序池的网站在进行配置更改后使用服务? – Dijkgraaf
@Andy:如果你仍然收到相同的错误信息,那么你还没有打开这个服务。 – NotMe