rip001
rip001

Reputation: 1

Connecting to Virtual Directory .NET Core

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

Answers (2)

samwu
samwu

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

John Meek
John Meek

Reputation: 181

Right click on the virtual folder and select advance settings and see what the physical path is and use that.

Upvotes: 1

Related Questions