Error is "The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."
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.