Tuesday, August 4, 2020

Business Central Download Symbols Error: No such host is known

By Steve Endow


UPDATE:  After researching this type of Windows hosts file name resolution issue, it seems there are dozens of possible reasons why the problem can occur.  I suspect my case was one of the simpler versions, and fortunately flushdns worked for me.  Here is a forum thread with examples of several rather odd causes and solutions.


This morning I tried to create a new Business Central AL project in VS Code.  I used AL Go! to create the project, set the server name in the launch.json file, and then tried to Download Symbols.

Very simple, very easy, right?

Nope.

No soup for you!

What? I performed these exact same steps 2 days ago on this same machine, and I was able to download symbols without any issues.

Here is the full video of the troubleshooting process:




I closed VS Code, relaunched it, created a new project, and tried again.  Same error.

Looking at the error log in VS Code, I saw "Error: No such host is known".  Say what?

(this screen shot shows a server name of test1 just to demonstrate the error)

You shall not pass, human


I checked Docker to make sure my container existed.

Affirmative:  test container exists and is healthy


I then opened a browser to see if my test container was working.  Yup, just fine.



I then tried to ping the test container.

Something weird be goin' on here

And there was my first clue.

Even though the browser could resolve the "test" container name, I was unable to ping the test container.

So, maybe there's an issue with the Windows hosts file?

There is a "test" server entry

Let's check if that is the correct IP for the Docker container.

Ya, that's the right IP


So, what have we learned:

1. VS Code apparently can't connect to the container due to a name resolution issue
2. The Windows hosts file is fine and has the correct container name and IP address
3. Chrome is able to connect to the container name just fine
4. Cannot ping the container name from a command prompt or PowerShell

So we seem to have a weird name resolution issue.

I then started thinking out loud during the live stream, thinking that I would try flushing the Windows name resolution cache.  Great minds think alike, and as I was using the wrong command (nbtstat), Sascha Hermann sent a note on Twitch to have me try "ipconfig /flushdns".  Ah, yes, that's the correct command.

And what do you know...

It's ALIVE!

Flushing the DNS cache resolved the ping issue.

I then went back to VS Code and attempted to download symbols again, and it worked fine.

So what happened?

1. My Windows Task that re-builds my "test" BC Container every morning ran fine
2. My "test" container was created and running properly
3. The Windows hosts file was updated with the correct IP address for the "test" container
4. Chrome was able to resolve the "test" name to the correct container IP
5. My command prompt, PowerShell, and VS Code were unable to resolve the container name
6. Flushing the DNS resolver cache fixed the issue


I don't know why this would occur, as this same machine worked fine 2 days ago.  But it seems that something prevented the DNS cache from updating when the new test container IP was added to it.

To address this potential issue, I'm going to add "ipconfig /flushdns" as the last step in my BC container build script that runs every morning.  Hopefully this will prevent the issue from occurring in the future.


Steve Endow is a Microsoft MVP in Los Angeles.  He works with Dynamics 365 Business Central, Microsoft Power Automate, Power Apps, Azure, .NET, Dynamics GP, and SQL Server.

You can also find him on Twitter and YouTube

https://www.precipioservices.com

No comments:

Post a Comment

All comments must be reviewed and approved before being published. Your comment will not appear immediately.

Why Business Central is Amazing #5: Community

 By Steve Endow The Business Central Community is amazing. Want proof?   Here's a great example from my Twitter timeline this afternoon:...