0

i can't seem to access my mounted azure file share from my API running inside IIS.

my API starts another C# Console application, but because of the user it gets started as, it will not access the files in my Z: drive (mounted azure file share).

People on the internet seem to have the option as creating a local user with the same name as my storage account and password as the access key. But it seems like there is a character limit on creating that user.

is there anyway i can start this C# Console Application with access to my mounted Z: drive? from my C# API running inside IIS. without having to rename my storage account and so. either by giving iis more access or starting the console application with more access.

hopefully there is a smarter way.

Sonny Hansen
  • 620
  • 1
  • 5
  • 18
  • Since your coding in C#, isn't using the storage API directly, without the file share overhead be preferable ? – Steve B Dec 06 '21 at 14:20
  • @SteveB Not though enough of that option i think, will i have the same possibilites to get list of files and copy a folder of files. Will the performance be better/the same this way then? Reason i mounted in first place, was to work directly with the files there. But that was to slow compared to copying them over first. – Sonny Hansen Dec 06 '21 at 14:27
  • I don't exactly how do azure file share works, but I get it's wrapper under a smb share. Using blob storage, I'm convinced you will benefits in performance. But that mean that what you are trying to achieve is addressable (donwload binary, write it, reupload binary). Quite easy with small files that can be loaded into memory, a bit more complex for large files. – Steve B Dec 06 '21 at 14:39
  • you could launch the console app using the System.Diagnostics.Process as that user who has access to that mounted drive, see the [example](https://stackoverflow.com/a/4624413/14973743) here. – Anand Sowmithiran Dec 06 '21 at 16:06
  • Why you don't use [rest api](https://learn.microsoft.com/en-us/rest/api/storageservices/operations-on-shares--file-service-) to access azure fileshare ? – Jason Pan Dec 07 '21 at 02:36
  • Mapped drives are not supported by IIS in any way, so your only option is to follow the answer below. – Lex Li Dec 07 '21 at 22:52

1 Answers1

0

You can create HttpClient in your C# code.

And you can use rest api to access your Azure File Share.

enter image description here

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • Because it seems way easier to copy 1GB of files from a folder, then trying to figure out how to do this with the API. And really though it would be possible to see network drives from within iis. – Sonny Hansen Dec 07 '21 at 08:57