Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Error 500

Hi,
How to resolve 500 error on web page? I did deploy the web project properly but why did the following error comes out?
User generated image
Avatar of Swatantra Bhargava
Swatantra Bhargava
Flag of India image

Due to your code error, you are getting this error. Cross check your code.
It helps a lot if you have implemented extensive exception handling and logging. Simplest thing to do probably is to have a catch-all exceptions page, show rather user friendly message on the front-end and log / mail actual technical exception details.
Hi HuaMin,

First things first, enable errors (Of course temporarily) on your website by modifying your web.config.

 <system.web>
...
        <customErrors mode="Off"/>
...
    </system.web>

Open in new window


Regards,
Chinmay.
I believe configuring browser is also necessary. Particularly in IE there is setting called "Show friendly HTTP error messages" which must be turned off. Deselect the check-box.

Go to Internet Options -> Advanced -> Browsing.

Hope it helps!
Avatar of Peter Chan

ASKER

Thanks to all.
Nitin,
Where is the option below?

User generated image
Patel,
I already have such codes

    <system.web>
      <customErrors mode="Off" />
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />

Open in new window

Hi Huamin,

In that case, do you have access to server's eventlog or any other kind of error log? If so, please check the eventlog as it can quickly tell us where exactly this error happening.

Regards,
Chinmay.
Nitin,
Such option is always on but I still get the below error, in IE.

User generated image
Sorry Patel, I am not sure which error in Event viewer is related to the issue.
Hi Huamin,

Is this site hosted on a hosting service server or your own server where you can access eventlog(Start -> Run ->eventvwr -> Windows Logs ->Application).
Here you can filter for errors (on your right hand side, check  Filter current log...) and search for ASP.Net related errors or for that matter any error that you can notice. See the screenshot below:

User generated image
Regards,
Chinmay.
Patel,
Yes, I do not see relevant error below

User generated image
Hi Huamin,

You have to search / filter for errors. I recently had some errors so it appeared in my list first. You could also check Web Server(In Server Roles) to check Web server specific errors.

Regards,
Chinmay.
Sorry, how to filter it by specific values below?
User generated image
Webserver 500 errors relate to catastrophic executable code crashes.

For example, calling PERL or PHP or ASP, where the executable PERL or PHP or ASP throws a fatal exception.

Simple refer to your Webserver logs or interpreter logs + you'll find the file + function + line number where the fatal was generated.

For example, here's a PHP Fatal I pulled out of a random site's log...

[14-Aug-2018 21:28:25 America/New_York] PHP Fatal error:  Uncaught Error: Call to undefined method WC_Product_Bundle::get_component_option() in /sites/client-name/site-name/wordpress/wp-content/plugins/woocommerce-composite-products/includes/compatibility/modules/class-wc-cp-pb-compatibility.php:72

Open in new window

Where can I get root reason to this error?
You're refer to your system's logs.

With LAMP Stacks (Linux + Apache + MariaDB + PHP) all these live in one spot + logging tends to be enabled high enough to actually catch most errors, in a way they can be debugged.

With Windows, your logs can be many places + you may have to increase your logging level just to get enough log data to debug the problem.

Sometimes the event viewer can be helpful. Many times not.

One approach is to run all your code, one script at a time outside your Webserver environment. If you can arrange to do this, then you'll instantly see the problem, in most cases.
Hi HuaMin,

For ASP.Net you will always get the error properly reported in Windows Event Logs - that is one of the reason I prefer ASP.Net over other technologies.

In your screenshot, I can see there is an IIS node (Custom Views -> Server Roles -> Web Server (IIS)) Please select Web Server (IIS) and post a screenshot here.

Regards,
Chinmay.
Yes, I see no errors in that
User generated image
Do you get this error with a different browser too?
Yes, on both IE and Chrome.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.