I have a shared drive on my local network \hostname\shared\resource. I have mounted the drive programattically from within the Asp.net core web application in the startup.cs file.
app.UseStaticFiles();
app.UseFileServer(new FileServerOptions{
FileProvider = new
PhysicalFileProvider(@"\\TS3410D618\NickFlicks\Movies"),
RequestPath = new PathString("/Movies"),
EnableDirectoryBrowsing = false
});
This works perfectly when I run it with IIS express(debugging), however, when I deploy it to my local IIS on the same machine the application fails to start with the error:
Application startup exception: System.ArgumentException: The directory name \\TS3410D618\NickFlicks\MoviePosters\ is invalid.
This is a valid UNC path and can be reached from everywhere I have tried on my windows 10 machine. As I mentioned everything is on the same machine except for the shared drive.
As a side note I can mount a virtual drive from within IIS sucessfully, so IIS can access the fileshare without any issues.
I'm not sure what I am doing wrong here, any help would be greatly appreciated.
I could never get this to work because I couldn't find a way to create an Active Directory with Windows 10 or to modify the user permissions for the UNC file share for the user used by IIS. Basically, I just installed Ubuntu server with Nginx as the reverse proxy and everything worked fine once I set up the permissions properly, which was very straight forward.