Getting -- ErrorCode: Unknown Message: FilePart upload failed

  • 1
  • Problem
  • Updated 4 months ago
  • (Edited)
I am trying to upload a stream with code

  using (var stream = new MemoryStream(Encoding.ASCII.GetBytes(logText)))
            {
                var baseFolderUri1 = sfClient.Items.GetAlias(FolderId);

                var uploadRequest = new UploadSpecificationRequest
                {
                    FileName = "TextFile.txt",
                    FileSize = stream.Length,
                    Details = "Sample details",
                    Parent = baseFolderUri1
                };

                var uploader = sfClient.GetFileUploader(uploadRequest, new PlatformFileStream(stream, stream.Length, "TextFile.txt"));

                var uploadResponse = uploader.Upload();

            }

Its working fine with my Console Application but I am working on a plugin type of project. I have a class library project after creating that I have to create a dll and upload it to that it's not working

getting Error -- ErrorCode: Unknown Message: FilePart upload failed

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) 
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) 
at ShareFile.Api.Client.Transfers.Uploaders.ScalingFileUploader.Upload(Dictionary`2 transferMetadata, Nullable`1 cancellationToken) 
at MorningSide.DocumentExport.Services.ShareFile.ShareFileV3.Upload(ShareFileClient sfClient, Stream fileStream, String parentFolder, String fileName) 
...  
Photo of Mosin

Mosin

  • 10 Posts
  • 0 Reply Likes

Posted 4 months ago

  • 1
Photo of Nikita Nuka

Nikita Nuka, Employee

  • 10 Posts
  • 2 Reply Likes
Hey, Mosin.
Thank you for contacting ShareFile.

Is it failing intermittently or always?
Also, can you, please, share your account ID/subdomain?

Thank you!

Best Regards,
Nikita Nuka.
Photo of Mosin

Mosin

  • 10 Posts
  • 0 Reply Likes
Thanks for your reply.
Photo of Mosin

Mosin

  • 10 Posts
  • 0 Reply Likes
it failing always.
Our subdomain is morningtrans.

Please provide us solution ASAP.
 
Photo of Nikita Nuka

Nikita Nuka, Employee

  • 10 Posts
  • 2 Reply Likes
Thank you, Mosin.
Can you, please, provide a little bit more information about the exception that is thrown?

The exception should be of type ShareFile.Api.Client.Exceptions.UploadException. Can you, please, get values of the following fields from an exception instance?
  • HttpStatusCode
  • ActiveUploadState
  • InnerException (with type, message, and stack trace).

Thank you in advance.
Photo of Mosin

Mosin

  • 10 Posts
  • 0 Reply Likes
Inner Exception Details are ... 

ShareFile.Api.Client.Exceptions.UploadException: ErrorCode: Unknown
Message: FilePart upload failed ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 172.254.49.7:443
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)
   at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at ShareFile.Api.Client.Extensions.Tasks.TaskExtensions.Rethrow(Task task)
   at ShareFile.Api.Client.Transfers.Uploaders.ScalingPartUploader.<>c__DisplayClass19_1.<Dispatch>b__1(Task workerTask)
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at ShareFile.Api.Client.Transfers.Uploaders.ScalingPartUploader.<>c__DisplayClass18_0.<Upload>b__0()
   at System.Threading.Tasks.Task.Execute()
Photo of Nikita Nuka

Nikita Nuka, Employee

  • 10 Posts
  • 2 Reply Likes
Thank you, Mosin.
That's very helpful.

As you can see from the error message, a host you're running your project on is not able to connect to your on-premise Storage Zone Controller (172.254.49.7, https://mtsharefilesz.morningtrans.com).

"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 172.254.49.7:443"

There might a firewall or network gateway in your infrastructure that prevents the host with your plugin from connecting to the Storage Zone Controller.

In order to resolve the issue, would you, please, make sure that the machine you're hosting your application/plugin on is able to connect to the Storage Zone Controller (172.254.49.7) on port 443.

Thank you.

Best Regards,
Nikita Nuka.
Photo of Mosin

Mosin

  • 10 Posts
  • 0 Reply Likes
Hi Nikita,

Thanks for your reply.

According to you, the host has failed to respond Storage Zone Controller (172.254.49.7) on port 443.
There might a firewall or network gateway in our infrastructure that prevents the host connecting to the Storage Zone Controller.

But as of now, we are able to create the directories on share file from the same machine where we hosted our application/plugin but it only not works with Upload functionalities.

Can you please provide some information about firewall or network gateway settings which we have to do.
 
Photo of Natan Avrahami

Natan Avrahami

  • 4 Posts
  • 0 Reply Likes
Hi, thanks for your help. I have logged in from the server where Mosin is testing and found this:



So we will try and clear the firewall to rule out any blocking issues.