Reputation: 7324
I have an asp.net core MVC application using Identity Server 4 which runs fine locally. However, when I deploy it to an Azure app service (the deploy is performed automatically based on check-in so no manual steps) the app fails to work as expected
I can:
I cannot:
My configure method isn’t particularly complex:
loggerFactory.AddConsole();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseIdentityServer();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme,
AutomaticAuthenticate = false,
AutomaticChallenge = false
});
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
But nothing on the MVC side seems to be functioning. When I browse to the homepage I simply get the View cannot be found:
An unhandled exception occurred while processing the request.
InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Views/Home/Index.cshtml
/Views/Shared/Index.cshtml
Upvotes: 1
Views: 505
Reputation: 2256
Check publishOptions
section in project.json
file - you have section with subsection include
. You need to add a relative path to "Views" folder here.
{
"publishOptions": {
"include": [
"wwwroot",
"Views",
...
]
},
}
Upvotes: 4