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
精彩评论