Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webdav restart while uploading file. Webdav upload error (async upload, largest file, parallel request) #81

Open
arfgndgd opened this issue Nov 1, 2022 · 0 comments

Comments

@arfgndgd
Copy link

arfgndgd commented Nov 1, 2022

Hello,

I'm having a problem with the webdav.client I'm using in my .Net Core project.

I'm having trouble loading the webdav file after the rest of my project is done. But this problem is not always the same. In some cases, it doesn't.

Webdav restart while uploading file

My webdav upload code is written asynchronously.

I'm having problems installing webdav similar to the scenarios below;

→ When I send multiple Postman requests to upload several large files (400mb - 10gb)

→ In some cases, the asynchronous webdav upload process does not finish for large or small files, and the upload does not take place (for only one request).

Can asynchronous operation logic cause problems with parallel loading requests?

Can asynchronous operation logic cause problems with parallel loading of large files?

Some code example;

`

        ResultDto<List<string>> webdavResult = new ResultDto<List<string>>() { IsSuccess = false, Message = "An error accured in webdav request" };
        try
        {
            if (string.IsNullOrEmpty(m_WebdavAdress))
                m_WebdavAdress = ConfigReader.Instance.GetWebdavAddress();

            Log.Information($"Webdav Adress: {m_WebdavAdress}");

            var baseAddress = string.Format("{0}/{1}", m_WebdavAdress, "path/");
            var timeout = TimeSpan.FromDays(7);
            var clientParams = new WebDavClientParams { BaseAddress = new Uri(baseAddress), Timeout = timeout };


            Log.Information($"Webdav Base Adress: {baseAddress}");

            WebDavResponse response;
            using (var client = new WebDavClient(clientParams))
            {
                FileStream file = File.OpenRead(filePath);
                var task = Task.Run(async () => await client.PutFile(filename + ".mkv", file)).ConfigureAwait(false);
                //var task = Task.Run(() => client.PutFile(filename + ".mkv", file));
                Log.Information($"Filename: {filename}");

                response = task.GetAwaiter().GetResult();
                Log.Information($"WebdavUploadAsync result {response?.IsSuccessful}");
            }

            List<string> exportWebdavurl = new List<string>() { string.Format("{0}/{1}/{2}", m_WebdavAdress, "path/", filename + ".mkv") };
            webdavResult = new ResultDto<List<string>>()
            {
                IsSuccess = response.IsSuccessful,
                Message = response.Description,
                Data = exportWebdavurl
            };

        }
        catch (Exception e)
        {
            Log.Error("Webdav upload error : " + e.Message);
            webdavResult = new ResultDto<List<string>>()
            {
                IsSuccess = false,
                Message = e.Message,
                Data = null
            };
        }

        return webdavResult;
    }

`

@arfgndgd arfgndgd changed the title Webdav upload error (async upload, largest file, parallel request) Webdav restart while uploading file. Webdav upload error (async upload, largest file, parallel request) Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant