我有以下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