Wie löse ich eine "Ansicht nicht gefunden" -Ausnahme in asp.net core mvc project
Ich versuche, eine ASP.NET Core MVC-Testanwendung zu erstellen, die unter OSX mit VS-Code ausgeführt wird. Ich erhalte die Ausnahme "Ansicht nicht gefunden", wenn ich auf die Standard-Startseite / den Standardindex (oder andere von mir ausgeführte Ansichten) zugreife.
Dies ist die Startkonfiguration
public void Configure(IApplicationBuilder app) {
// use for development
app.UseDeveloperExceptionPage();
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseMvc( routes => {
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}"
);
});
}
Und ich habe die Ansicht in @ definieViews/Home/index.cshtml
, und ich habe die folgenden Pakete auf project.json @ enthalt
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.AspNetCore.Razor.Tools" : "1.0.0-preview1-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Routing": "1.0.0-rc2-final"
},
Und schließlich ist dies die Ausnahme, die ich bekomme.
System.InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Views/Home/Index.cshtml
/Views/Shared/Index.cshtml
at Microsoft.AspNetCore.Mvc.ViewEngines.ViewEngineResult.EnsureSuccessful(IEnumerable`1 originalLocations)
at Microsoft.AspNetCore.Mvc.ViewResult.<ExecuteResultAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown --- ...
Irgendwelche Vorschläge, was mir fehlen könnte?