以下是错误信息:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.OpenStream(Uri uri)
at System.Xml.XmlTextReaderImpl.PushExternalEntity(SchemaEntity entity, Int32 entityId)
at System.Xml.XmlTextReaderImpl.DtdParserProxy_PushEntity(SchemaEntity entity, Int32 entityId)
at System.Xml.XmlTextReaderImpl.DtdParserProxy.System.Xml.IDtdParserAdapter.PushEntity(SchemaEntity entity, Int32 entityId)
at System.Xml.DtdParser.HandleEntityReference(XmlQualifiedName entityName, Boolean paramEntity, Boolean inLiteral, Boolean inAttribute)
at System.Xml.DtdParser.HandleEntityReference(Boolean paramEntity, Boolean inLiteral, Boolean inAttribute)
at System.Xml.DtdParser.GetToken(Boolean needWhiteSpace)
at System.Xml.DtdParser.ParseSubset()
at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)
at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(TextReader txtReader)
at Com.Founder.NewsBridge.FTPReceive.FTPRceiveActor.LoadXMLFile(FileInfoDTO fidto)
我用的加载方法是:
XmlDocument result = null;
StreamReader sr = null;
try
{
sr = new StreamReader(filepath, Encoding.Unicode);
result = new XmlDocument();
result.Load(sr);
sr.Close();
}
catch (Exception e)
{
try { if (sr != null) sr.Close(); }
catch (Exception ex) { }
// TODOLOG
}
很着急,不知道为什么?在别人机器上好用,在我自己这就报错,大家帮帮忙