Review the Rest API log files when troubleshooting.


I am trying to access a token, but get "Authentication failed".

Error message

{"error":"invalid_grant","error_description":"Authentication failed."}

If I use --data-urlencode, I get an unsupported_grant_type error.


Resolution

You must use a SystemWeaver username and password to be able to get a token.


I am trying to access a token, but get a "404" error.

Error message

404 unauthorized


Resolution

Confirm the following: 

  • There is no firewall stopping your access to the Rest API. 
  • The URL to obtain a token is correct.
  • The URL does not contain any line breaks.
  • You are using valid SystemWeaver login credentials.

The Rest API's connection to the SystemWeaver server is unstable.

Error message

Connection to serverA:1111 failed. System.Exception: Unable to connect to server, name:serverA, port:1111, Message: No connection could be made because the target machine actively refused it 123.45.67.890:1111 ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it


Resolution

Confirm that users can connect to the SystemWeaver server with a client application. Verify that there is no firewall stopping the Rest API server from connecting to the SystemWeaver server. 


I am unable to reach the Rest API via a browser. 

Error message

ERR_SSL_PROTOCOL_ERROR

or

ERR_CONNECTION_TIMED_OUT


Resolution

This error relates to the set up of the certificate when using "requireHttps": true. Check that the certificate is properly set up, e.g., in correct location, added to the correct port, has the correct subject name, etc. Configuring the SystemWeaver REST API Server


I am unable to reach the Rest API documentation via the web using Internet Explorer. 


Resolution

The documentation doesn't load in Internet Explorer because support for it has been dropped in Swagger UI which is used for the documentation. Switch to another browser.


The Rest API is running as an executable with https enabled, but I am unable to reach it via the web. 

Error message

User profile is available. Using 'C:\Users\john.doe\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest. 

Unhandled exception while processing 0HM6VPT1O95KC. System.ComponentModel.Win32Exception (0x8009030D): The credentials supplied to the package were not recognized


Resolution

Run the executable as Administrator.


I am unable to reach the Rest API. 

Error message

2022-03-01 13:49:58.2656 Unable to start Kestrel. System.IO.IOException: Failed to bind to address http://[::]:4040: address already in use.

 ---> Microsoft.AspNetCore.Connections.AddressInUseException: Only one usage of each socket address (protocol/network address/port) is normally permitted.

 ---> System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.


Resolution

The port set for "restApiPort" in appsettings.json is already in use. Use a different port. 

If you have two SystemWeaver Rest APIs running on the same server machine, they cannot use the same port.

If you have two SystemWeaver Rest APIs running on different machines, and logging in to the same SystemWeaver server application, they cannot use the same port. 


The Rest API will not start.

Error message

ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY


Resolution

AspNetCore is trying to use HTTP2 on a machine that doesn't support it without manual configuration (Windows Server 2012 R2/Windows 8.1 and below). This is a known bug that has been fixed in the master branch of AspNetCore, but the fix is not officially rolled out as of this writing (2021-03-05). The solution is to set "allowHttp2": false in the appsettings.json.


I am unable to run the Rest API executable with https enabled.

Error message

Unhandled exception. System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.


Resolution

The certificate must be located in a specific location. It must be in Local Computer/Personal/Certificates. 

Check that the certificate is in this location and not in Root. (Configuring the SystemWeaver REST API Server)