Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. System.Net.Http.HttpRequestException: Connection Refused

System.Net.Http.HttpRequestException: Connection refused

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Fischer , 17 January, 2020
Forums
Gurux.DLMS.AMI

Hi there!

My first attempt to run AMI on Ubuntu 18.04 was stuck here.
Any ideas on how to overcome this?
Just testing/simulating - no real device connected.

sudo dotnet Gurux.DLMS.AMI.dll

Listening port:1000
RestAddress: http://localhost:64881
Database type: SQLite
Connecting: Data Source=:memory:
Creating tables.

Unhandled Exception: Service started: http://localhost:64881
System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
at System.Threading.Tasks.ValueTask`1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Gurux.DLMS.AMI.Startup.AddSchedule() in C:\vsts-agent-win7-x64-2.124.0\_work\39\s\Gurux.DLMS.AMI\Startup.cs:line 331
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Aborted

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Fischer,

Hi Fischer,

I just tested this with Debian and we are getting the same error.
We'll check this. A new version is released during next week where this is fixed.

BR,
Mikko

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

For ad-hoc. Open appsettings.json.
Change this:
"Client": {
"Address": "http://localhost:64881"
},

to:
"Address": "http://YOU_IP_ADDRESS:64881"

I don't know why "localhost" doesn't work in linux, but I'll try to solve this.

BR,

Mikko

Fischer

6 years 4 months ago

In reply to Hi, by Kurumi

I tried. The same response,

I tried. The same response, just ip changed.

hostname -i
127.0.1.1 192.168.0.21

sudo dotnet Gurux.DLMS.AMI.dll

Listening port:1000
RestAddress: http://192.168.0.21:64881
Database type: SQLite
Connecting: Data Source=:memory:
Creating tables.

Unhandled Exception: Service started: http://192.168.0.21:64881
System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
.....

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

Do you have a firewall? I'll ask to install Ubuntu 18.04 and we'll try with that.
Can you also run this and post result here.
dotnet --version

BR,
Mikko
BR,

Mikko

Fischer

6 years 4 months ago

$ dotnet --version

I know 2.2 is required, but I did "sudo apt install dotnet-sdk-2.2" and expected it would help...

$ dotnet --version
3.1.101

$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529961

Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/3.1.101/

Host (useful for support):
Version: 3.1.1
Commit: a1388f194c

.NET Core SDKs installed:
2.2.402 [/usr/share/dotnet/sdk]
3.1.101 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

The new version is released next week where is support for .NET 3.1.
I believe that it fixes your problems.

BR,
Mikko

Fischer

6 years 4 months ago

I changed the version adding

I changed the version adding global.json to "Gurux.DLMS.AMI directory".
Now the version is:

$ dotnet --version
2.2.402

but the response is still the same:

$ sudo dotnet Gurux.DLMS.AMI.dll

Listening port:1000
RestAddress: http://192.168.0.21:64881
Database type: SQLite
Connecting: Data Source=:memory:
Creating tables.

Unhandled Exception: Service started: http://192.168.0.21:64881
System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
...

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

New version is released. It's using .Net Core 3.1. .Net Core 2.1 was not working very well with some distros, like yours.
For some reason, "localhost" as target address still fails.
You need to change the client address as described above.

BR,
Mikko

Fischer

6 years 4 months ago

Now, after upgrading to the

Now, after upgrading to the new version I get this warning:
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.

Is it necessary to correct something?
(The web server http://192.168.0.21:64881/api/info is running.)

sudo dotnet Gurux.DLMS.AMI.dll

Listening port:1000
Notifing port:4059
RestAddress: http://192.168.0.21:64881
Database type: SQLite
Connecting: Data Source=:memory:
Creating tables.
Service started: http://192.168.0.21:64881
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
+
+
+

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

We have released a new version where we have improved data structures so .Net Core 3.1 for Linux can handle it.

BR,

Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin