C# EWS流媒体订阅系统.Xml.XmlException

C# EWS流媒体订阅系统.Xml.XmlException,c#,xml,exception-handling,exchangewebservices,exchange-server,C#,Xml,Exception Handling,Exchangewebservices,Exchange Server,我有一个EWS流媒体订阅,我想不断运行。它在特定收件箱中等待新邮件事件,当事件触发时,它读取电子邮件并将内容发布到其他Web服务。在大多数情况下,这非常有效,但是每次抛出System.Xml.XmlException时: Unhandled Exception: System.Xml.XmlException: '▼', hexadecimal value 0 invalid character. Line 1, position 1. at System.Xml.XmlTextReaderIm

我有一个EWS流媒体订阅,我想不断运行。它在特定收件箱中等待新邮件事件,当事件触发时,它读取电子邮件并将内容发布到其他Web服务。在大多数情况下,这非常有效,但是每次抛出System.Xml.XmlException时:

Unhandled Exception: System.Xml.XmlException: '▼', hexadecimal value 0
invalid character. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args)
at System.Xml.XmlTextReaderImpl.ParseText(Int32& startPos, Int32& e
32& outOrChars)
at System.Xml.XmlTextReaderImpl.ParseText()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read()
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read(XmlNodeTyp
)
at Microsoft.Exchange.WebServices.Data.EwsXmlReader.InternalReadEle
mespace xmlNamespace, String localName, XmlNodeType nodeType)
at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadRespo
viceXmlReader ewsXmlReader)
at Microsoft.Exchange.WebServices.Data.HangingServiceRequestBase.Pa
es(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(
te)
at System.Threading.ExecutionContext.Run(ExecutionContext execution
ontextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThr
kItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
我看过其他关于这个例外的帖子,但似乎没有一篇有解决办法。我怎样才能阻止它被抛出

更新:


以防有人有同样的问题。我们已将服务器升级到2010 sp2,问题似乎已得到解决。

这是一个超出您控制范围的内部错误

如果服务器是2007SP1,则将其升级到2010。如果是2010年,请使用最新的服务发布补丁验证其运行情况


如果所有这些都完成了,但仍然存在,请使用您的MSDN订阅(或当前的软件支持合同),并与Microsoft支持部门联系,让他们与您一起调查。他们可能有一个未发布的服务版本,可能会解决此问题。

我很想这样做,但在调试时无法重新创建异常,因此我不知道xml是否在电子邮件正文中,是否是来自POST服务器的响应,是否是来自Exchange服务器在重新连接期间的响应。您需要将日志记录添加到异常处理中。又名
try{}catch{Log.(“current email/xml”)}
如果你想复制/修复它的话,这是一种类似的东西。我所有的代码都被
try{}catch(){}
异常处理所包围,所以当它被捕获时,你需要获取失败的xml并保存它。我理解这一点,从概念上讲,我的代码就是这样设置的(所有其他异常都是通过这种方式成功管理的)。但是,应用程序没有像我想象的那样工作,而是失败了,上面的异常显示在控制台上。