1
Error when using FileUploader in an Azure App Service when the target in Azure Storage
Problem reported by Dave Draffin - 4/23/2020 at 8:36 AM
Submitted
I'm developing a file uploader implementation that is hosted on an Azure App Service .Net Core 3.1 App. When running locally all works fine, however when deployed to azure, the Uploader rejects uploads, and reports 

"Access to the path "[UploadLocation]:\test.txt" is denied due to insufficient permissions. Please make sure the current windows identity "IIS APPPOOL\EX-FileUpload20230508125922 (Impersonation)" has the required permissions on the path.

I'm not sure why the the service would be looking to do impersonation here.

The FileUploader class config is here 

 var fileUploader = new FileUploader
{
Width = 600,
Height = 300,
Resizable = false,
UploadLocation = new GleamTech.FileSystems.Physical.PhysicalLocation
{
Path = @"\\adtdatacapture1.file.core.windows.net\pendingfiles",
UserName = "adtdatacapture1",
     Password = _keyFileStorage
}
}
fileUploader.Uploaded += evnt_FileUploader_Uploaded;

Are there any examples of folks successfully hosting the component in an app service.

N.B, if an UploadLocation that points to the local file storage of the app service e.g. "~/App_Data/Uploads" then the upload is completed successfully.

1 Reply

Reply to Thread
0
Cem Alacayir Replied
Employee Post
I guess you are trying to connect to "Azure Files".
This is different than Azure Blobs and it acts like a SMB network share so you can connect to Azure Files via using its UNC path: 

    UploadLocation = new PhysicalLocation
    {
        //UNC path to the Azure Files
        //This can be found on the "Connect" blade of the File Storage Account in Azure Portal
        Path = @"\\demostorage.file.core.windows.net\data",
        
        UserName = "Storage Account Name",
        Password = "One of the Azure Storage Account's Access Keys"
    }

For App Service, you may need to mount the file share:

References:

Reply to Thread