2

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

6
  • Can you open the page on the web-server? So you get a specific error. You should also check the config in web.config for error-pages. (Remote only, Off, On) Commented May 20, 2012 at 14:00
  • Do you use 'trusted connection' or did you put the credentials in the connection string? Commented May 20, 2012 at 14:02
  • 1
    Also you could check the server's event log looking for the exception Commented May 20, 2012 at 14:02
  • Yes i can. In internet explorer im getting The website cannot display the page. and in fire fox im getting same error as in remote computer Commented May 20, 2012 at 14:02
  • yes i am using trusted connection Commented May 20, 2012 at 14:03

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

7 Comments

Thank you for replay app pool is configured correctly i have errors in Event viewer :Login failed for user 'IIS APPPOOL\NGG'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
That sounds like permissions on your database then. Either file permissions if it's something like SqlCe, or specify a username and password in the connection string if it's SQL Server/Express.
Please advice me something. I dont know how to do. How i can google my problem?
You'll need to supply some more details, such as what database engine you're using, what your connection string looks like etc.
@Acid, does that use "IIS APPPOOL\NGG" have permission to access the database?
|
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.