Connect Visual Studio Code to Business Central on premise

I cannot download symbols from Business Central (2019 second wave). Business Central is on a server and I have Visual Studio Code on my local PC.

App.json:
{
"id": "a31dcs4b-0ab4-4134-98ae-f3c780b5b0ad",
"name": "Moes",
"publisher": "Default publisher",
"version": "1.0.0.0",
"brief": "",
"description": "",
"privacyStatement": "",
"EULA": "",
"help": "",
"url": "",
"logo": "",
"target": "OnPrem",
"dependencies": [
{
"appId": "63ca2fa4-4f03-4f2b-a480-172faf340d3f",
"publisher": "Microsoft",
"name": "System Application",
"version": "1.0.0.0"
},
{
"appId": "437dbf0e-84ff-417a-965d-ed2fb9650972",
"publisher": "Microsoft",
"name": "Base Application",
"version": "15.0.0.0"
}
],
"screenshots": [],
"platform": "15.0.0.0",
"idRanges": [
{
"from": 50100,
"to": 50149
}
],
"contextSensitiveHelpUrl": "https://Moes.com/help/",
"showMyCode": true,
"runtime": "4.0"
}

launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "al",
"request": "launch",
"name": "Moes",
"server": "http://md15nav.adm.moes.dk/Moes-D365BC13-Udv",
"serverInstance": "Moes-D365BC13-Udv",
"authentication": "Windows",
"tenant": "",
"startupObjectId": 22,
"startupObjectType": "Page",
"breakOnError": true,
"launchBrowser": true,
"enableLongRunningSqlStatements": true,
"enableSqlInformationDebugger": true,
"port": 7042
}
]
}

I get this error when trying to download symbols:

"Error: Der opstod en fejl under afsendelse af anmodningen. Fjernserveren returnerede en fejl: (401) Uautoriseret. Hovednavnet er ikke korrekt."

(Something like: An error occurred while sending the request. The remote server returned an error: (401). Unauthorized. The main name is not correct.")

I'll read your replies on Friday.

Answers

  • archer89archer89 Member Posts: 337
    set server:"http://md15nav.adm.moes.dk" instead
    and/or NavUserPassword as authentication
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • MortenSteengaardMortenSteengaard Member Posts: 130
    Thank you very much for your reply, archer89!

    If I use
    - "server": "http://md15nav.adm.moes.dk"
    - "authentication": "Windows"

    I get the same error.

    If I use
    - "server": "http://md15nav.adm.moes.dk"
    - "authentication": "UserPassword"

    and enter the user id and password, I get this:
    "Using reference symbols cache path: c:\Users\mortens\Documents\AL\Moes\./.alpackages
    Sending request to http://md15nav.adm.moes.dk:7042/Moes-D365BC13-Udv/dev/packages?publisher=Microsoft&appName=System&versionText=15.0.0.0
    Sending request to http://md15nav.adm.moes.dk:7042/Moes-D365BC13-Udv/dev/packages?publisher=Microsoft&appName=System Application&versionText=1.0.0.0
    Sending request to http://md15nav.adm.moes.dk:7042/Moes-D365BC13-Udv/dev/packages?publisher=Microsoft&appName=Base Application&versionText=15.0.0.0"

    and then I can enter user id and password again and again and get the 3 "Sending request"-lines every time.

    I enter the user id and password, that I use on my local pc and also when I connect to the NAV-server using remote desktop. I also use the same user id and password when I open Business Central in browser from my pc.

    When I open Business Central in browser from my pc, I use this link: "https://md15nav.adm.moes.dk/Moes-D365BC13-Udv/". If I in launch.json use https:
    - "server": "https://md15nav.adm.moes.dk"

    I get this:
    "Error: Der opstod en fejl under afsendelse af anmodningen.
    Den underliggende forbindelse blev lukket: Der opstod en uventet fejl ved afsendelse..
    Handshake mislykkedes på grund af et uventet pakkeformat."

    Something like: "The underlying connection was closed. An unexpected error occured. The hand shake didn't succed because of an unexpected package format".
  • Wisa123Wisa123 Member Posts: 308
    Hi,

    Few tips, and common errors that led me to the same errors, maybe this helps:
    1.) If your Instance is set to Windows auth, use Ctrl+alt+p AL: Clear Credential Cache, as it allows you to reenter windows Creds if you mistyped them the first time.
    2.) After changing anything in lauch.json try to Ctrl+alt+p Developer: Reload Window
    3.) If you run Multitentant it is absolutely mandatory to fill in the tentant parameter in launch.json

    First three things that came to mind. Let me know if any of these helped.

    /Wisa
    Austrian NAV/BC Dev
  • PhoguePhogue Member Posts: 76
    edited 2019-12-27
                ...
                "server": "http://md15nav.adm.moes.dk",
                "serverInstance": "Moes-D365BC13-Udv",
                "authentication": "UserPassword",
                ...
    

    If this launch file doesnt work, the problem is likely an error with the SSL/TLS authentication.

    This error is a common symptom when mixing up HTTP and HTTPS, which could happen if your server requires encryption and redirects to https - can you check the packet with Wireshark or some similar tool?


    else I can only suggest checking the following:
    • Is the correct port specified?
    • Are the ports opened in the firewall?
    • Is any other application blocking this port?

    God jul :)
  • MortenSteengaardMortenSteengaard Member Posts: 130
    Thanks, Wisa123, but no solution yet...

    1. I've cleared credential cache many times.
    2. I've reloaded the window and restarted VS Code many times.
    3. I can see that "Multitenant" is NOT set and therefore I set "Tenant" to blank. I assume this is correct.

    That didn't change anything.
  • MortenSteengaardMortenSteengaard Member Posts: 130
    Hi Phogue,

    I'll look into the port and firewall asap. I need a colleague to do this.

    God jul og godt nytår :smile:
Sign In or Register to comment.