0
哪有WCF CommunicationObject
过渡到故障状态:我创建了Visual Studio中的WCF库,它部署到IIS,里面我有两种方法:WCF故障状态
public string GetData(int value)
{
throw new FaultException(value.ToString());
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
throw new TestException();
}
从客户端,我只需一遍又一遍地调用这两种方法,但是,CommunicationObjectFaultedException
不会在任何时候抛出。
我在文章WCF error handling and some best practices中读到,非FaultExceptions被默认“自动”转换为FaultException。如果这是正确的,那么WCF客户端的通信对象何时以及如何成为故障状态?
另一件事,是否有人知道任何MSDN参考,确认FaultException
是确保WCF通信对象不会转换为Faulted state
的最佳方法。