public override Task <UploadReply> Upload(UploadRequest request, ServerCallContext context) { UploadReply result = new UploadReply(); try { Stream imageStream = new MemoryStream(request.File.ToByteArray()); Image originalImage = Image.FromStream(imageStream); List <Image> images = ImageFactory.CreateNewSizeImages(originalImage); SaveModel saveModel = new SaveModel() { Directory = request.Directory, FileName = request.FileName, Images = images, OriginalImage = originalImage }; var saveList = imageCollectionSaver.Save(saveModel); result.UploadPath = "upload/" + request.Directory + request.FileName; } catch (Exception ex) { result = new UploadReply() { ErrorMessage = ex.Message, HasError = true }; } return(Task.FromResult(result)); }