Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Error is "The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."

C#
public int ImportLogistiCareData(List<Importlogisticare> lstImportlogisticare, int VendorId, TransportationVendorTypes vendorType)
       {
           try
           {
               using (LINAServiceClient oLINAServiceClient = new LINAServiceClient())
               {
                   Mapper.CreateMap<Importlogisticare, IMPORTLOGISTICARE>()
                       .ForMember(dest => dest.ID, opts => opts.MapFrom(src => src.ID))
                       .ForMember(dest => dest.REGION, opts => opts.MapFrom(src => src.Region))
                       .ForMember(dest => dest.TRIPID, opts => opts.MapFrom(src => src.Trip_Id))
                       .ForMember(dest => dest.JOBNO, opts => opts.MapFrom(src => src.Job_No))
                       .ForMember(dest => dest.DATEOFSERVICE, opts => opts.MapFrom(src => src.Dateof_Service))
                       .ForMember(dest => dest.PICKFROM_TIME, opts => opts.MapFrom(src => src.Pickfrom_Time))
                       .ForMember(dest => dest.APPOINTMENT_TIME, opts => opts.MapFrom(src => src.Appointment_Time))
                       .ForMember(dest => dest.AGE, opts => opts.MapFrom(src => src.Age))
                       .ForMember(dest => dest.HOME_PHONE, opts => opts.MapFrom(src => src.Home_Phone));
                   IMPORTLOGISTICARE[] oIMPORTLOGISTICARE = Mapper.Map<IMPORTLOGISTICARE[]>(lstImportlogisticare);
                   return oLINAServiceClient.ImportFile(null, oIMPORTLOGISTICARE, VendorId, Convert.ToInt32(lstImportlogisticare[0].LASTUPDATEDBY), vendorType);

               }
           }
          
           catch (Exception)
           {
               throw;
           }
       }



Here, "oIMPORTLOGISTICARE" is the object of passing 50 records. If it is less than 50 its working fine.
Posted
Updated 10-Dec-14 1:06am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900