开发者

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

开发者 https://www.devze.com 2023-02-21 20:44 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

I've started MVC 3 project and it work without problem on localhost. But when i upload开发者_如何学编程ed 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!


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.


Problem solved: There was a difference in MVC version between my provider server and my developement environment

0

精彩评论

暂无评论...
验证码 换一张
取 消