I have an simple .NET 4.5 mvc app, which performs simple file upload to a directory.
This app has been containerized to windows container and deployed on Azure app service webapp as containers.
It has option to mount Azure files storage as persistent storage volume to the container.
So I have mapped the mount to point the upload directory. The idea is when user upload the file, it will go to Azure Filestorage via the mount volume.
The mount is successful, how ever when trying to upload getting error "The Parameter is Incorrect" from system.IO.
If we inspect the Azure Filestorage from the storage explorer, there is been an empty file being created. Not sure what is going wrong.
2020-10-17 02:36:20,959 82924433ms INFO FileHelper UpLoadFile - ToFilePath : C:\inetpub\wwwroot\FileStorage\UserProfileImages\banner-img.jpg
2020-10-17 02:36:20,975 82924449ms ERROR FileHelper UpLoadFile - Error in saving file. The parameter is incorrect.
2020-10-17 02:36:20,975 82924449ms ERROR FileHelper UpLoadFile - System.IO.IOException: The parameter is incorrect.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at System.Web.HttpPostedFile.SaveAs(String filename)
at ConnecTiQa.Mvc.Helpers.FileHelper.UpLoadFile(HttpPostedFileBase file, HttpServerUtilityBase server, String rename, String SaveFilePath) in C:\app\ConnecTiQa.Mvc\Helpers\FileHelper.cs:line 204
Update 1:
Not only update. Having issue with accessing the file(reading) from the mounted volume as well.
The problem is that the mount in the Windows container only has the permission RX, see the screenshot here:You do not have the write permission in the mount point, so you cannot write the content into the files.Update:
I made a mistake and I'm sorry about that. The mount point is the path that you set in the path mappings. For example, if you set the mount path as
/inetpub/wwwroot/filestorage/mnt
, then the mount point is the final foldermnt
, and all the actions in it would be incorrect:I'm not sure if this the issue, but I guess it's the problem.