Question

How to fix asp.net API 500 internal server error - ubuntu droplet

Posted October 4, 2021 70 views
ApacheAPIDeploymentInitial Server SetupUbuntu 20.04DigitalOcean Droplets

I just deployed my .net 5.0 app to ubuntu Droplet, in which Apache proxy was configured by run below commands without any issue:

a2enmod proxy proxyhttp proxyhtml rewrite
systemctl restart apache2
sudo ufw allow ‘Apache Full’

When visit my site, all the static content display properly. However, there is issue to access API controllers and thus failed retrieving data.

Error Info from server journalctl:
……
Request finished HTTP/1.1 GET http://myIp/api/ads/adsImage/images - - - 500 - application/json 7.7037ms
.....

Error from my client:
“Http failure response for http://myIp/api/ads/adsImage/images: 500 Internal Server Error”

Is this issue related to proxy or CORS or my code? Local testing was absolutely successful.

How should I to figure it out?

Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @gdliu,

Usually, the 500 Internal Server Error is connected with some misconfiguration on either your Apache config file or your .htaccess.

The best solution would be to check your Apache error_log in /var/log/apache2. In there (in the log), you should be able to see the exact reason behind the 500 error and correct it.

Regards,
KFSys

  • Thanks for pointing this out. I checked Apache error log and found these errors:
    [proxy_http:error] [pid 34211:tid 140143541335808] (20014)Internal error (specific information not available): [client 135.0.151.82:15599] AH01102: error reading status line from remote server 127.0.0.1>

    [proxy:error] [pid 34211:tid 140143541335808] [client 135.0.151.82:15599] AH00898: Error reading from remote server returned by /server-error

    [proxy:error] [pid 34211:tid 140143432230656] (111)Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:5000 (127.0.0.1) failed

    [proxy_http:error] [pid 34211:tid 140143432230656] [client 135.0.151.82:17956] AH01114: HTTP: failed to make connection to backend: 127.0.0.1,

    Can you please provide further help?
    Thanks!