asp.net mvc 3 web application does not working aft

2020-04-16 03:24发布

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

I have clicked publish button in Visual Studio 2010. Published it on local folder and then copied in server.

I am getting error > Sorry, an error occurred while processing your request.

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.

Thanks

3条回答
等我变得足够好
2楼-- · 2020-04-16 04:10

Check the following:

  • The app pool you're deploying it to in IIS is using the correct version of .NET (should be using a .NET 4 Integrated Mode App Pool)
  • If it's an error that's preventing anything from running in ASP.NET, then errors should be being logged to the Event Log on the server. Check the Application and/or System log.
查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-04-16 04:21

There is some error in some code of that requested page. So ASP.NET MVC is showing the content of error.cshtml.

You can disable custom error page in your web.config so that you can see the error in the browser. Keep in mind that not only you, everyone can see that. So you better change that settings back once you figure out what is the problem. You can also set the value to remoteonly so that that only it will be visible from the server. This works only if you have remote access to the server.

查看更多
别忘想泡老子
4楼-- · 2020-04-16 04:25

First you have to know what is the exception that is causing the error view to show up.

I can suggest you three options.

  1. Turn off the <customErrors> section, so the HandleError filter won't work and you can see the real exception.

  2. 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>
    
  3. 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.

查看更多
登录 后发表回答