我有以下ASP.NET核心项目结构:从文件夹中提供静态文件里面的wwwroot
.
├── Controllers
├── Dockerfile
├── Models
├── Program.cs
├── Properties
├── README.md
├── Services
├── Startup.cs
├── Views
├── appsettings.json
├── bundleconfig.json
├── project.json
├── web.config
└── wwwroot
里面wwwroot
,我已经建立了使用奥里利亚cli
的奥里利亚项目。它具有以下结构:
.
├── aurelia-app
├── css
├── images
├── js
└── temp.html
和我的aurelia-app
有index.html
文件,我想服务(当我浏览到localhost:5000
,以类似的方式,如果它是在wwwroot
)
这里就是我的Startup.cs
配置()方法是这样的:
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseFileServer(new FileServerOptions
{
EnableDefaultFiles = true,
EnableDirectoryBrowsing = true,
});
app.UseMvc();
}
我应该怎么改变,这样在加载基本URL,它会寻找index.html
文件中wwwroot/aurelia-app
目录?
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files – Alexan
是的,我已经使用'PhysicalFileProvider'解决方案试过,但我得到的错误'找不到PhysicalFileProvider',我该如何补充? – akshayKhot
我正在使用VSCode,所以不知道如何在没有'nuget'的情况下添加外部依赖关系。 – akshayKhot