How to Resolve 500 Internal Server Error

How to resolve 500 Internal Server Error?

debugging, fixing, and resolving a server error from an Ajax call is exactly the same process as any other request.

  1. Check the web server error logs for any indications of what the error is

  2. Introduce debug statements into the serverside code around where the error is occuring (and add a little bit to your ajax request to dump all the response as plain text)

It may also be useful to copy the URL and querystring used in the Ajax call and paste it into your browser to view any responses.

Firebug for Firefox is also a useful diagnostic tool for testing what is being sent as part of the Ajax call and what is being sent back as a response.

500 Internal Server Error for some but not others

Non-logged in users got the error but logged in users didn't.

.Net application - 500 Internal Server Error

  1. Navigate to %WINDIR%\system32\inetsrv\config\
  2. Create a backup copy of the file applicationhost.config and save it to a different location.
  3. Open the applicationhost.config in Notepad.
  4. Search for the following entry and Remove or disable the XPress compression schema from the configuration using the command below:
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpCompression /-[name='xpress']
  5. Verify if the compression schema has been removed form the applicationhost.config.
  6. Save the applicationhost.config and restart IIS services.

Cannot Resolve a 500 (Internal Server Error) Code

I would try to put a more verbose exception in your code. Also, I think you can have the error check inside your try...accept

@app.route('/todos/create', methods=['POST'])
def create_todo():
body = {}
try:
description = request.get_json()['description']
list_id = request.get_json()['list_id']
todo = Todo(description=description)
active_list = TodoList.query.get(list_id)
todo.list = active_list
db.session.add(todo)
db.session.commit()
body['description'] = todo.description
return jsonify(body)
except Exception as e:
print(e) # ------- tracing
db.session.rollback()
print(sys.exc_info())
finally:
db.session.close()

abort(500)


Related Topics



Leave a reply



Submit