First, in MyException, remove the inheritance from Exception and make it public.
Secondly, when you declare your service contract, declare an exception as follows:
[FaultContractAttribute( typeof(MyException), Action = "", Name = "MyException", Namespace = "YourNamespace")] [System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)] [OperationContract] void Foo()
Finally, you can throw your exception as follows:
throw new FaultException<MyException> ( new MyException(ex.Message), new FaultReason("Description of your Fault") );
Hope this helps.
source share