客户端异常处理


 try

                {

                    service.AddOperateLog(mol);

                }

                catch (Exception ex)

                {

                    if (service.InnerChannel.State == System.ServiceModel.CommunicationState.Faulted)

                    {

                        service = new QhrServiceClient();

                        MyExceptionRecord my = new MyExceptionRecord();

                        my.Id = System.Guid.NewGuid().ToString();

                        my.OccurrenceTime = DateTime.Now;

                        my.ExceptionType = "Operation";

                        my.OperationName = "AddOperateLog";

                        my.ExceptionMessage = ex.Message;

                        my.Status = 1;

 

                        service.CreateExceptionRecord(my);

                    }

                }

 

 

原文地址:https://www.cnblogs.com/quietwalk/p/2283760.html