问题描述
我的项目中有一个 XSD 文件,我想使用文件流写入这个 XSD 文件的内容,但它抛出错误,例如: ReadTimeout = 'fs.ReadTimeout' 引发了类型为“system.invalidOperationException”的异常 WriteTimeout = 'fs.WriteTimeout' 引发了类型为 'system.invalidOperationException' 的异常
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Resources"
targetNamespace="http://tempuri.org/SecurityZoneResources.xsd"
elementFormDefault="qualified" xmlns="http://tempuri.org/Resources.xsd"
xmlns:mstns="http://tempuri.org/Resources.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Document">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Details">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:long" />
<xs:element name="DomainID" type="xs:long" />
<xs:element name="GroupID" type="xs:long" minOccurs="0" />
<xs:element name="Name" type="xs:string" minOccurs="0" />
<xs:element name="Owner" type="xs:string" minOccurs="0" />
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="Policy" type="xs:string" minOccurs="0" />
<xs:element name="IsDeleted" type="xs:boolean" />
<xs:element name="Created" type="xs:dateTime" />
<xs:element name="CreatedBy" type="xs:string" />
<xs:element name="Updated" type="xs:dateTime" minOccurs="0" />
<xs:element name="UpdatedBy" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="DocumentKey1">
<xs:selector xpath=".//mstns:Details" />
<xs:field xpath="mstns:ID" />
</xs:unique>
<xs:unique name="Table1_Constraint1">
<xs:selector xpath=".//mstns:SecurityZoneResources" />
<xs:field xpath="mstns:ResourceID" />
</xs:unique>
</xs:element>
</xs:schema>
文件流
private FileStream getFileStream(string fileName)
{
// read Schema
FileStream fs = new FileStream(String.Format(@"{0}\{1}",Server.MapPath(@"..\Schemas"),fileName),FileMode.Open,FileAccess.Read);
return fs;
}
这个 fs 抛出错误 ReadTimeout = 'fs.ReadTimeout' 引发了类型为“system.invalidOperationException”的异常 WriteTimeout = 'fs.WriteTimeout' 引发了类型为 'system.invalidOperationException' 的异常
如何解决?有人有任何线索吗?为什么我会收到 ReadTimeout 和 WriteTimeout 错误。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)