c# WebAPI linux working on mounted network folder

23 views Asked by At

Im mounting a folder on linux. When i try to write/copy/move a file using my webapi it fails. It can create/delete folders and files, but cant write to them or read them. If i try to move, it will move the file but it will create an empty file at output location. If the program executs the linux "mv" command it happens the same thing. The same code on a normal linux console app works.

The only way i foud to create a file with content on webapi is

                         using (var memoryStream = new MemoryStream())
                            {Task.Run(async () =>
                            {   
                                await filepond.CopyToAsync(memoryStream);
                            }).Wait();
                            memoryStream.Seek(0, SeekOrigin.Begin); // Reset the position to the beginning
                            using (var fs = System.IO.File.Create(filePath))
                            {
                                Task.Run(async () =>
                                {
                                    await fs.WriteAsync(memoryStream.ToArray());
                                }).Wait();
                                
                            }

But i still need a way to read it

0

There are 0 answers