I have an MVC website that works fine running locally but when I deploy it to my Azure Website I get this error for every webpage except the Home Index page.
The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Sales/Index.aspx
~/Views/Sales/Index.ascx
~/Views/Shared/Index.aspx
~/Views/Shared/Index.ascx
~/Views/Sales/Index.cshtml
~/Views/Sales/Index.vbhtml
~/Views/Shared/Index.cshtml
~/Views/Shared/Index.vbhtml
I can provide more information, if necessary, but I haven't been able to find anyone with the same issue in all the reports of this issue. Most people legitimately have the issue of the file in the wrong place. But, my structure of Controllers and Views are fine, they work locally. It only fails to find the Views when its deployed to my Azure Website.
In the properties of each of the views I had to change the Build Action to Content and the publish actually deployed the .cshtml files.
For those with an ASP.NET Core application, the solution was to add "Views" to the publishOptions.include
array:
"publishOptions": {
"include": [
"wwwroot",
"Views",
"web.config"
]
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With