Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Fault Contract in WCF

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 36
    Comment on it

    While making WCF service you need to ensure that all errors needs to be logged .

    For doing that we will need to use a operation contract called fault tolerance

     

    [ServiceContract]
    public interface ISimpleService
    {
                   [OperationContract]
                   string SimpleOperation();
    }
    public class SimpleService : ISimpleService
    {
                  public string SimpleOperation()
                 {
                      //Some code here
                      throw new Exception(Exception occurred at service level : SimpleOperation error);
                 }
    }
    [DataContract]
    public class CustomFaultDetails
    {
                [DataMember]
                public string ErrorID { get; set; }
               
                [DataMember]
                public string ErrorDetails { get; set; }
    }

     

    We can track the error details by creating model class for the error which contains its type and details

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: