Kystverket / IMO-Maritime-Single-Window

An IMO coordinated project developing a generic Maritime Single Window.
MIT License
28 stars 16 forks source link

500 Internal server error #96

Closed mgalil closed 4 years ago

mgalil commented 5 years ago

After I have installed the latest version, I get login screen and entered credentials agent@imo-msw.org/agent, faced the following error "500 Internal server error" and imo logo did not displayed.

62276021-6dd51380-b443-11e9-924d-7ec3887a2aaf 1

bardlokas commented 5 years ago

Is your database up and running?

Can you access it from pgadmin?

Are the names of the db correct in regards to the Appsettings.json file?

Does the localhost:5000 Page work?

mgalil commented 5 years ago

image image

Appsettings.json: { "ConnectionStrings": { "OpenSSN": "User ID=user;Password=Root1234;Host=localhost;Port=5432;Database=imomsw;", "UserDatabase": "" }, "AppSettings": { "Secret" : "TopSekritSecretToken" } }

bardlokas commented 5 years ago

And you get the same error on 5000 when logging in? Can you send me the complete error?

bardlokas commented 5 years ago

When you launch the project.Can you see it as a user liste as connected from pgadmin?

mgalil commented 5 years ago

yes get the same error on 5000. "When you launch the project.Can you see it as a user liste as connected from pgadmin?" I didn't understand? please more clarification

bardlokas commented 5 years ago

When you run the project as instructed in the readme. Can you see the user you reference in the aposettings file as a connected user when looking in pgadmin? It will be listed as a session next to the postgres user

mgalil commented 5 years ago

username: agent@imo-msw.org password: agent image

bardlokas commented 5 years ago

What version of the SQL script did you run? When you fixed the previous issue you posted (when you had to get the new version), it seems like you might have forgotten to run the new script associated with that version.

Solution:

mgalil commented 5 years ago

I have deleted the database and reinstall PostgreSQL
and run the most recent script you provide me at the above link, but again get the same error ""500 Internal server error" 62422769-070c6000-b6b8-11e9-9aad-0f7dd772c712 1

bardlokas commented 5 years ago

And on localhost 5000?

mgalil commented 5 years ago

yes, get the same error on localhost 5000.

mgalil commented 5 years ago

any update ...

bardlokas commented 5 years ago

Sorry for the late response, this issue occured in the middle of my travels. Can you send me an email with the error displayed in the console of your browser? email: post@bardlokas.no

bardlokas commented 5 years ago

Has the issue been resolved?

mgalil commented 5 years ago

any news !

bardlokas commented 5 years ago

Did you see my last reply? I need some more information to be able to help you. Can you open the console of your browser and show me what it says when that error appears? To open the console press F12 and select "console".

mgalil commented 4 years ago

Hi bardlokas ,

I'm so sorry, I was on vacation for Eid al-Adha feast and I didn't read your updates. for http://localhost:4201: image

for http://localhost:5000: image

bardlokas commented 4 years ago

It doesnt show anything more than just "500 internal server error" ? What credentials are you trying to log in with?

mgalil commented 4 years ago

username: agent@imo-msw.org password: agent

bardlokas commented 4 years ago

And you get no more information than "500 internal server error"? You are on the latest branches of master ?

mgalil commented 4 years ago

yes, latest version...

bardlokas commented 4 years ago

The only error you get is "500 internal server error" It doesnt say anything more below that or a dropdown arrow you can click?

bardlokas commented 4 years ago

Are you able to start the server solution with visual studio in debug mode and see what the error is then?

mgalil commented 4 years ago

Ok .. I will try and feed you back.

bardlokas commented 4 years ago

By the way, what versions of chocolatey, npm and node are you on? To check what version you have installed: Open a command window (cmd) and type "choco -v" "node -v" and "npm -v".

mgalil commented 4 years ago

image

bardlokas commented 4 years ago

That seems okay I have something else you can try instead of running the server with visual studio if you are having issues with that: In the cmd window where you ran the "dotnet watch run" command, the error should display. So run the project as usual, try to login so you get the 500 error and look in the cmd window and look for the error there.

bardlokas commented 4 years ago

If this is going to slow for you; You can send me an email at post@bardlokas.no and we can fix it faster via skype or something. I can then post the solution here for other people who might have the same issue.

mgalil commented 4 years ago

image

image

bardlokas commented 4 years ago

Do you have a user set up in the DB with the name "user" ?

bardlokas commented 4 years ago

You can see your users in pgadmin.

  1. Select your server
  2. Select your database (imomsw)
  3. Open the dropdown (login/group roles) bilde
mgalil commented 4 years ago

image

bardlokas commented 4 years ago

Change your appsettings to point to "postgres" instead of "user". If it still doesn't work change your settings to: " "OpenSSN": "User ID=postgres;Host=localhost;Port=5432;Database=imomsw;keepalive=60;", "

mgalil commented 4 years ago

appsettings.json file content:

{ "ConnectionStrings": { "OpenSSN": "User ID=postgres;Password=**;Host=localhost;Port=5432;Database=imomsw;", "UserDatabase": "" }, "AppSettings": { "Secret" : "TopSekritSecretToken" } }

bardlokas commented 4 years ago

does it work?

mgalil commented 4 years ago

user was already "postgres" not "user"

bardlokas commented 4 years ago

Remove the password settings, so it looks the same as the one i posted above

bardlokas commented 4 years ago

And just to make sure: you have a table named public."user" correct?

Also: http://localhost:5000/api/Portcall/1

Does this page display any information (it should be showed in a .json format)

mgalil commented 4 years ago
bardlokas commented 4 years ago

Did you get any error messages when running the sql script?

bardlokas commented 4 years ago

If you already have the "imomsw" database: remove the line: "CREATE DATABASE imomsw WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'C.UTF-8' LC_CTYPE = 'C.UTF-8';" from the script before running it.

bardlokas commented 4 years ago

Has the issue been resolved?

mgalil commented 4 years ago

image

bardlokas commented 4 years ago

Did you see my previous comment? If the script ran successfully you should have tables. If you dont have any tables it didn't run succesfully.

bardlokas commented 4 years ago

An error should occur when trying to run the script. It mainly contains create table / insert into statements so if you have nothing most of it must've failed

bardlokas commented 4 years ago

You ran the script towards the wrong database. You have two options:

  1. Change your appsettings to point to the "postgres" database instead of "imomsw"
  2. Run the script on the "imomsw" database.
mgalil commented 4 years ago

I tried the two options .. but get the same error "500 Internal Server Error"

bardlokas commented 4 years ago

Can you verify that you have a table named "users" in your imomsw database? You should now have:

  1. A database named imomsw with 65 tables
  2. Your appsettings.json file should point to the imomsw database with the correct username

If you still get an error. What error is showing in the terminal when you run "dotnet watch run" ?

mgalil commented 4 years ago

image

image

image

bardlokas commented 4 years ago

Those are just warnings not errors. Can you try to make the 500 error appear while having the terminal open? And the tables you just sent are from the "imomsw" database, correct?