问题描述
我已经在IIS 7上部署了asp.net mvc 3剃刀视图引擎应用程序.服务器使用Windows Server 2008和sql server2008.安装了asp.net mvc 3
I have deplyoed asp.net mvc 3 razor view engine application on IIS 7. Server using windows server 2008 with sql server 2008. There is installed asp.net mvc 3
我在Visual Studio 2010中单击了发布"按钮.将其发布在本地文件夹中,然后复制到服务器中.
I have clicked publish button in Visual Studio 2010. Published it on local folder and then copied in server.
我遇到错误> Sorry, an error occurred while processing your request.
此错误仅显示确实需要sql连接的视图,因此其他页面可以完美加载.
This error shows only that views which does needs sql connection so other pages loading perfectly.
我确定我已使用正确的连接字符串更改了连接字符串.
I am sure that i have changed connection string with correct connection string.
请帮助我,网络上没有任何帮助.
Please help me there is not anything helpful in web.
谢谢
推荐答案
首先,您必须知道导致错误视图显示的异常是什么.
First you have to know what is the exception that is causing the error view to show up.
我可以建议您三个选择.
I can suggest you three options.
-
关闭>部分,因此
HandleError
过滤器将不起作用,并且您会看到实际异常.
Turn off the
<customErrors
> section, so theHandleError
filter won't work and you can see the real exception.
HandleError
筛选器还会将HandleErrorInfo
实例传递到错误视图,因此您可以在错误视图本身中显示完整的异常(只是要知道错误不是生产中的明智之举) ).通过访问该模型.
The HandleError
filter also passes a HandleErrorInfo
instance to the error view, so you can display the complete exception in the error view itself (just to know the error not a wise idea in production) by accessing that model.
@model System.Web.Mvc.HandleErrorInfo
<p>
The exception is: @Model.Exception
</p>
您可以尝试 ELMAH 库,该库记录了所有未处理的异常. HandleError
过滤器可抑制该异常并阻止其由 ELMAH 记录,因此在尝试 ELMAH 时,最好关闭HandleError
.您必须在单独的数据库中配置ELMAH
,它提供的页面列出了所有最近的错误.
You can try ELMAH library that records all the un-handled exceptions. The HandleError
filter suppresses the exception and stops them logged by ELMAH, so you should better switch off the HandleError
when you are trying ELMAH. You have to configure the ELMAH
in a separate database and it provides a page that lists all the recent errors.
这篇关于部署后,asp.net mvc 3 Web应用程序无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!