Vũ *_*àng 5 wcf workflow workflowservice workflow-foundation-4
我有一个工作流服务。我还在该服务中使用了工作流持久性。但是在 IIS 中部署工作流后,我从客户端向服务器上的日志文件中的工作流服务发出请求。我看到一条消息
The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}SaveWorkflow was interrupted by an error.InnerException Message: Type 'System.ServiceModel.Channels.ReceivedFault' cannot be serialized.
Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
Run Code Online (Sandbox Code Playgroud)
我尝试了有关此异常的研究,但没有发现任何内容。
如何解决这个问题?或者让我知道上述异常的原因是什么?
System.ServiceModel.Channels.ReceivedFault是一个不可序列化的内部.NET 框架类,因此不幸的是,您无法纠正实际的根本原因(即使所述类可序列化)。
您可能正在通过 WCF 调用外部服务,该服务出现故障,即System.ServiceModel.FaultException抛出 a。IIRC,在那个FaultException对象深处的某个地方是对罪魁祸首的引用,一个ReceivedFault实例。
解决方法:捕获所有的FaultExceptions,将需要知道的信息从the中转FaultException成可序列化的异常,并抛出后者:
try
{
CallService();
}
catch (FaultException ex)
{
// Gather all info you need from the FaultException
// and transport it in a serializable exception type.
// I'm just using Exception and the message as an example.
throw new Exception(ex.Message);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1755 次 |
| 最近记录: |