Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC 3 The view 'Error' or its master was not found or no view engine supports the searched locations [closed]

I've started MVC 3 project and it work without problem on localhost. But when i uploaded it on my hosting server I've recived error:

System.InvalidOperationException
The view 'Error' or its master was not found or no view engine supports the searched locations

I dont have any 'Error' method in my controlers and as I said, on localhost everything was ok. How can I resolve my problem?

Thanks in advance!

like image 274
zgorawski Avatar asked Apr 02 '11 18:04

zgorawski


1 Answers

You should have an Error.cshtml / Error.aspx file in the ~/Views/Shared folder. This view is rendered if you enabled custom errors in web.config:

<customErrors mode="On" />

and if an exception is thrown. So here's a possible explanation: you don't have this view (although it is automatically added by the default MVC 3 project template) and when you deployed your project on the hosting server some exception occurs which doesn't occur locally and when the framework tries to render the Error view it doesn't find it thus the error you are getting. So you could try to disable custom errors temporarily in order to see the real exception you are getting or if you have a logging framework setup (which you should by the way, elmah's cool) look at the logs.

like image 114
Darin Dimitrov Avatar answered Nov 07 '22 23:11

Darin Dimitrov