Failed to load resource: the server responded with a status of 404 (Not Found)
我使用MVS 2015年的Web模式調試和我有鏈接自定義CSS來MVC6
app.UseStaticFiles();
,我使用常見的HTTP功能,因此出了什麼問題?
Failed to load resource: the server responded with a status of 404 (Not Found)
我使用MVS 2015年的Web模式調試和我有鏈接自定義CSS來MVC6
app.UseStaticFiles();
,我使用常見的HTTP功能,因此出了什麼問題?
您需要在您的project.json中有依賴關係。
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final"
注意:ASP.net MVC默認查看wwwroot
文件夾中的靜態內容。但是,如果要更改它,則需要將其覆蓋爲Startup.cs
var staticContentFolder = new DirectoryInfo(env.WebRootPath).Parent;
if (staticContentFolder != null)
{
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(
Path.Combine(staticContentFolder.FullName, "Contents")),
RequestPath = new PathString("/Contents")
});
}
請提供錯誤請求的完整路徑。您可能正在尋找錯誤位置的資源。再次,沒有完整的跟蹤,很難找出問題 – Saleem