开发者

Exceptions and TDetail

开发者 https://www.devze.com 2023-03-15 16:43 出处:网络
Here\'s what I need to do: catch (System.ServiceModel.FaultException&l开发者_开发知识库t;CustomFault> ex)

Here's what I need to do:

catch (System.ServiceModel.FaultException&l开发者_开发知识库t;CustomFault> ex)
{
    throw ex;
}

The problem is, the fault I'm getting is

System.ServiceModel.Security.MessageSecurityException

How do I return the custom fault?


Are you trying to catch the fault server-side? That's not going to work; MessageSecurityException is thrown before server code gets executed.

If you're trying to catch the fault in client-side code, just use

catch (System.ServiceModel.Security.MessageSecurityException ex)
{
    // handle exception
} 
0

精彩评论

暂无评论...
验证码 换一张
取 消