我正在尝试使用以下代码将 .net 类库中的虚拟故障消息发送到 ESB 管理门户。已经消费了 ESB ExceptionHandling Service 提供的 WCF 服务并创建了它的客户端。
ExceptionHandlingClient clientESB = new ExceptionHandlingClient();
FaultMessage faultMsg = new FaultMessage();
faultMsg.Header = new FaultMessageHeader();
faultMsg.Header.Application = "Exception Handling Service Test";
faultMsg.Header.Description = "Fault Message Header";
faultMsg.Header.ErrorType = "Error Type";
faultMsg.Header.FaultSeverity = 1;
faultMsg.Header.FaultCode = "Fault Code";
faultMsg.Header.FailureCategory = "Failure Category";
faultMsg.Header.FaultDescription = "Fault Description";
faultMsg.Header.FaultGenerator = "Fault Generator";
faultMsg.Header.Scope = "Fault Message Scopte";
faultMsg.Header.ServiceInstanceID = System.Guid.NewGuid().ToString();
faultMsg.Header.ServiceName = "Exception Service";
faultMsg.Header.MachineName = System.Environment.MachineName;
faultMsg.Header.DateTime = System.DateTime.Now.ToString();
faultMsg.Header.ControlBit = "1";
faultMsg.Header.MessageID = System.Guid.NewGuid().ToString();
faultMsg.Header.ActivityIdentity = "Activity Identity ";
faultMsg.Header.NACK = false;
//Use the 'client' variable to call operations on the service.
clientESB.Open();
clientESB.SubmitFault(faultMsg);
当上面的代码执行时,它成功地设置了 FaultMessage 对象的属性。此请求在到达 ALL.Exceptions 发送端口时失败,并显示以下错误消息。
执行发送管道失败:“Microsoft.Practices.ESB.ExceptionHandling.Pipelines.ESBFaultProcessor,Microsoft.Practices.ESB.ExceptionHandling.Pipelines,Version=2.1.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”来源:“ESB BAM Tracker" 发送端口:"ALL.Exceptions" URI:"SQL://(local)/EsbExceptionDb/" 原因:文件意外结束。以下元素未关闭:ns0:FaultMessage。第 20 行,第 12 位。