Botframework-emulator: Connect to a bot running on localhost

Created on 23 Dec 2016  路  12Comments  路  Source: microsoft/BotFramework-Emulator

I cannot seem to connect to my application running on localhost from visual studio using the Bot Emulator(v3.5). I keep getting the error "connect ECONNREFUSED" even when the application is started.

Can anyone help?

Most helpful comment

same here!

  • Downloaded the latest template & VS 2017
  • put the templates in the proper folder
  • created new project from template
  • built it for dependencies
  • registered bot online
  • rebuild bot with new keys
  • starting up latest emulator
  • receiving: "POST connect ECONNREFUSED 127.0.0.1:3978 "

----------------------------- UPDATE PEBCAC -------------------------
When starting the Bot Service, wait for the browser to open and check if you are indeed using the correct port! My bot was then running on 3979. Once i changed that the Emulator worked out of the box.

All 12 comments

Hi @chuksogbolime, I can help troubleshoot. A few questions:

  • Do you know which port is your localhost bot listening on?
  • What are you specifying for your bot endpoint in the emulator? Is it something like http://localhost:3978/api/messages?

I have the same issue.
Here is the Log:
[02:40:15] Application is up to date.
[02:40:43] -> POST connect ECONNREFUSED 127.0.0.1:3978

The bot endpoint is: http://localhost:3978/api/messages

I have tried this with and without MSA. Also turned off all firewalls.

Observation:
When I use the VS template and run the bot, the emulator doesn't work.
But, when the build and run the Echo Bot sample, the emulator works.

Log:
[02:56:40] Application is up to date.
[02:59:18] -> POST connect ECONNREFUSED 127.0.0.1:3978
[03:02:43] <- POST 200 Reply[message] Welcome User /* Connected to echobot running on port 53318*/
[03:02:44] <- POST 200 Reply[message] Welcome User!
[03:02:44] -> POST 202 [conversationUpdate]
[03:03:17] <- POST 200 Reply[message] 1: You said hello
[03:03:18] -> POST 202 [message] hello

I have been able to get around this issue. I think the problem was with the visual studio template version I installed. I have updated it to 3.4.0 and used it to build a sample Bot Application and it works fine.

@chuksogbolime Can you please share the link/ resource from where I can get the 3.4.0 template. Thanks!
~abhishan

@abhishan, you will need to delete the template file placed in the c# template directory as directed by the documentation and then install the template (Bot_Application) directly from visual studio created by Yowko Tsai.

@abhishan, here is a link I found https://www.nuget.org/packages/Microsoft.Bot.Builder/

This issue appears to be resolved. Closing it now. If I'm incorrect, please let me know and I will reopen.

I am having the same problem with version 3.5 of the bot builder framework. Is there another version of the template? I create a project from scratch using 3.5 of the framework and used the controller from the template but I still have the same issue - econnrefused .

After also seeing this [https://github.com/Microsoft/BotFramework-Emulator/issues/58] I changed the port of my bot project to 3978 and all was well.

same here!

  • Downloaded the latest template & VS 2017
  • put the templates in the proper folder
  • created new project from template
  • built it for dependencies
  • registered bot online
  • rebuild bot with new keys
  • starting up latest emulator
  • receiving: "POST connect ECONNREFUSED 127.0.0.1:3978 "

----------------------------- UPDATE PEBCAC -------------------------
When starting the Bot Service, wait for the browser to open and check if you are indeed using the correct port! My bot was then running on 3979. Once i changed that the Emulator worked out of the box.

I followed the instruction over here : https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-quickstart
But it didn't work. Its giving me the error : POST connect ECONNREFUSED 127.0.0.1:3978
URL is http://localhost:3978/api/messages

This is happening in the botframework-emulator. Have used ngrok aslo.
Any idea why this is happening?

Had faced a couple of issues while trying to get the bot emulator connect to my bot application on localhost but finally was able to make a connection. Here is how -

  1. Created a new project in VS 2015 from a new 'bot application' template.
  2. Clear the MicrosoftAppId and MicrosoftAppPassword values from the web config.
  3. Ensure that you're project runs on the URL http://localhost:3978/ (test in the browser to verify this). Keep the app running (assuming its on IIS Express). As per this article, the URL has to be localhost:3978.
  4. Open bot framework emulator.
  5. Connect to the URL endpoint http://localhost:3978/api/messages where 3978 is the same port that we just set for our web application and /api/messages is the POST endpoint for our bot as per the template we downloaded.
  6. Keep the values for 'Microsoft App Id' and 'Microsoft App Password' blank. Locale is set to en-US by default (you cannot set this blank).
  7. You should be able to connect and see 200 [conversationUpdate] messages exchanged at the bottom-right of the bot emulator.

Note: As per the installed template, I was using Microsoft.Bot.Builder version 3.0.0 and this produced a warning message in the bot emulator but it still worked. As per the recommendation (>=3.5.0), I updated it to 3.5.1.

You can also add breakpoints in your code and debug the code using this process.

Hope this helps!

Thanks,
Clyde

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Spydernaz picture Spydernaz  路  5Comments

giorigor picture giorigor  路  4Comments

Jay-study-nildana picture Jay-study-nildana  路  4Comments

iMicknl picture iMicknl  路  6Comments

wlopez-enkoding picture wlopez-enkoding  路  5Comments