Access the mapped drive using IIS to run the asp.net mvc web application

I deployed the asp.net mvc web application to IIS 8 inside a virtual machine (Windows Server 2012 R2). The laser file storage appears as a network drive on this Windows Server 2012 R2 virtual machine. Now my asp.net mvc web application should read the files and folders of this mapped drive using the C # System.IO code. By default, IIS is not allowed to access mapped drives.

This is why a web application throws a System.IO exception

"Could not find the specified path Z: \"

. I also tried to get through "\\\\{storage-name}.file.core.windows.net\\{fileshare-name} but still no success.

Can someone help me with the correct settings and the settings that I have to do in IIS and the web application?

+4
source share
2 answers

Finally, I was able to access the mapped network drive through IIS Server. I have completed the following steps.

  • Create a new user account in the virtual machine.
  • The username for this new account will be the vault account name
  • The password for this user will be the repository account key , which ends with "=="
  • After creating this new user account, I changed the type of account for this user to Administrator
  • Go to My Computer OR This PC
  • a > .
  • IIS,
  • , - ( DefaultAppPool ... .
  • Identity .
  • true.
  • OK, .
  • , .
  • - Default We Site.
  • ..., .
  • , .
  • ... , ( ) ( ).

. # IO . .

var allDirs = Directory.GetDirectories("\\\\<storageaccountname>.file.core.windows.net\\<storagefileshare>");
ViewBag.Items = allDirs;

, UNC-, .

+4

Source: https://habr.com/ru/post/1628857/


All Articles