Friday, July 28, 2017

Async Client Troubleshoot: Unable to authenticate username and password

As I was setting async client service up I was constantly getting an error everytime I test the connection. I checked the event viewer and the error I would get is relating to username and password. I have checked to make sure the credentials in AX matches the one I had setup in the Async Client Configuration Tool. I sync metadata and nothing seems to work. I didn't have any SSL certificate error and my async server works perfectly fine on my async client host. So after digging around and talking with Microsoft we found out that there were duplicate records in the dbo.DATASTORE table that was preventing the async client tool to authenticate the username and password.

1. To remedy the problem we need to go to where we created our Async Server Message Database.
2. Query the dbo.DATASTORE table.
3. Delete the duplicates record (you might run into an FK error because other tables are also using the same record.) Make sure you delete those childs records and then come back and delete the duplicates record in the dbo.DATASTORE table.
4. Once that is done go back in AX > Retail > Channel Database form and fill out the credential.
5. Go to Retail scheduler parameters and click "Sync metadata".
6. If you query the dbo.DATASTORE table you should only see one record.
7. Go back to Async Client Configuration Tool, fill the credential exactly like how you had in AX.
8. Click "Test Connection" you should get a message box prompting "Connection successful".
9. Go to Services and restart the Async Client service.
10. Go to back to Channel database form in AX and run your job and see if it applied. If the job applied your async client service is working like it supposed to.



EDIT:
This is a cascading delete on those FK constraints. If you still get constraints errors make sure you delete other child records first. Go into your channel database and create a new query. Copy the following queries and execute to delete all child records.

delete from DOWNLOADSESSIONDATASTORE where datastoreid in (select id from datastore where name = 'RetailStore')
delete from DATASTOREHEARTBEATLOG where datastoreid in (select id from datastore where name = 'RetailStore')
delete from UPLOADSESSIONLOG where datastoreid in (select id from datastore where name = 'RetailStore')
delete from DATASTORE where name = 'RetailStore'

Hopefully this will help those that are stuck and unable to get the async client service up and running. Cheers!