无法使用虚拟目录访问ASP.net核心应用程序之外的文件

问题描述 投票:2回答:1

我在IIS中托管了ASP.net Core应用程序,我在wwwroot \ images文件夹中添加了一个虚拟目录。但我无法访问该文件夹中的内容。谁能帮我?我需要在多个ASP.net Core站点之间共享图像,所以我尝试使用虚拟目录。

enter image description here

virtual-directory asp.net-core-1.0 iis-10
1个回答
0
投票

几周前我遇到了一些问题。如果您的项目是跨平台的,则需要使用如下虚拟文件夹:

app.UseFileServer(new FileServerOptions()
            {
                FileProvider = new PhysicalFileProvider(@"D:\files"),
                RequestPath = new PathString("/files"),
                EnableDirectoryBrowsing = false // you make this true or false.
            });

在iis中设置将无法正常工作

© www.soinside.com 2019 - 2024. All rights reserved.