Reputation: 1
I have an app that needs access to a virtual directory in IIS. I created the virtual directory in IIS and given it the correct permissions, I'm attempting to connect to it in my startup.cs like so..
app.UseFileServer(new FileServerOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(),
"Folder")),
RequestPath = "/Folder",
});
But, when I start the site in IIS im getting this error: The directorty name 'C:\inetpub\wwwroot\myappfolder\Folder does not exist. Any thoughts on this?
Upvotes: 0
Views: 1503
Reputation: 5205
UseStaticFiles equal to create an independent virtual directory in middleware tier instead of IIS level so it will never read IIS virtual directory. It is recommended to cancel the virtual directory inside your IIS and just map the path string in PhysicalFileProvider constructor.
More information about app.UseStaticFiles you can refer to this link: app.UseStaticFiles
Upvotes: 2
Reputation: 181
Right click on the virtual folder and select advance settings and see what the physical path is and use that.
Upvotes: 1