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. Forums
  3. Exception While Running AMI Server On Centos

Exception while running AMI server on Centos

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 rahul.singh@ra… , 23 January, 2020
Forums
Gurux.DLMS.AMI

Hi Mikko ,

When i am trying to run GuruxAMI on Centos server
we are getting following exception

System.Net.Http.HttpRequestException: Connection refused
---> System.Net.Sockets.SocketException (111): 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.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
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 134
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Aborted

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

1. Try to change localhost to your IP address.
Change this from appsettings.json
"Client": {
"Address": "http://localhost:64881&quot;
},
to
"Client": {
"Address": "http://YOUR IP ADDRESS:64881"
},

It's not yet clear why localhost is not working on Linux.

2. Run your app with sudo.

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

Hi Mikko ,

Hi Mikko ,

Did the same , But getting same exception.

My appsetting.jsom

"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"Reader": {
"Id": "603C1F03-6EDE-4F4F-B108-3451383F0B0F",
"Name": "Default",
"Threads": 10,
"TaskWaitTime": 60
},
"Scheduler": {
"Disabled": "False"
},
"Listener": {
"Port": 1000,
"Interface": 0,
"UseLogicalNameReferencing": "True",
"ClientAddress": 16,
"ServerAddress": 1,
"Authentication": 0,
"Password": null,
"Security": 0,
"InvocationCounter": "0.0.43.1.1.255",
"DefaultDeviceTemplate": 0
},
"Notify": {
"Port": 4059,
"ExpirationTime": 60,
"Parser": "Gurux.DLMS.AMI.NotifyParser.dll;Gurux.DLMS.AMI.NotifyParser.GXNotifyParser"
},
"Server": {
"Address": "http://*:9002"
},
"Client": {
"Address": "http://192.168.100.88:9002&quot;
},
"Database": {
"Type": "SQLite",
"Settings": "Data Source=:memory:"
}
}

Exception:

Listening port:1000
Notifing port:4059
RestAddress: http://192.168.100.88:9002
Database type: SQLite
Connecting: Data Source=:memory:
Creating tables.
Unhandled exception. Service started: http://192.168.100.88:9002
System.Net.Http.HttpRequestException: Connection refused
---> System.Net.Sockets.SocketException (111): 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.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
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 134
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Aborted

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

Can you run this and post result here.

dotnet --version

BR,
Mikko

polyrem

6 years 4 months ago

My AMI ( On Centos 7, and on

My AMI ( On Centos 7, and on Windows server 2016, with .NET 3.1.101 ) starts with same log mesages,
Connection refused
+++++++++++++++++++++++++
System.Net.Http.HttpRequestException: Connection refused
---> System.Net.Sockets.SocketException (111): 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.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
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.Reader.ReaderService.DoWork() in C:\vsts-agent-win7-x64-2.124.0\_work\39\s\Gurux.DLMS.AMI\Reader\ReaderService.cs:line 106

but ends with:
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.

rahul's AMI aborted, but mine works, and waits ( on port 1000 ) for data from meter.

But it is impossible to set GXDLMSDirector. After check DataConcentrator there is an error message ( without message ):

Test connection is succeeded, but it is no possible to import template.

Image
Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

Have you installed .AspNetCore.ASP?
Can you run this:
dotnet --list-runtimes
and this
dotnet --list-sdks

Then check differences:
dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.15 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

BR,
Mikko

polyrem

6 years 4 months ago

dotnet --list-runtimes

dotnet --list-runtimes
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

dotnet --list-sdks
3.1.101 [C:\Program Files\dotnet\sdk]

polyrem

6 years 4 months ago

and on Centos:

and on Centos:
dotnet --list-runtimes
Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

dotnet --list-sdks
3.1.101 [/usr/share/dotnet/sdk]

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

HI Miiko ,

HI Miiko ,

[root@ip-192-168-100-88]# dotnet --list-runtimes

Microsoft.AspNetCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

[root@ip-192-168-100-88]# dotnet --list-sdks

2.1.4 [/usr/share/dotnet/sdk]
3.1.101 [/usr/share/dotnet/sdk]

[root@ip-192-168-100-88]# dotnet --version
3.1.101

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

It works without problems with clean install.
Have you installed Apache?

Run this:
sudo yum update -y
sudo yum -y install httpd mod_ssl

If it still fails, get the source code:
https://github.com/Gurux/Gurux.DLMS.AMI/archive/master.zip
then try to build this with
dotnet build Gurux.DLMS.AMI.sln

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

Hi Mikko ,

Hi Mikko ,

Httpd is installed
[root@ip-192-168-100-88]# yum install httpd -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Repository packages-microsoft-com-prod is listed more than once in the configuration
33 packages excluded due to repository priority protections
Package httpd-2.4.41-1.amzn2.0.1.x86_64 already installed and latest version
Nothing to do

Build with provided source code
But still we are getting following exception

Listening port:1000
Notifing port:4059
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 (111): 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.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
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 /opt/RadiusHES/Gurux.DLMS.AMI-master/Gurux.DLMS.AMI/Startup.cs:line 134
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__139_1(Object state)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Aborted

rahul.singh@ra…

6 years 4 months ago

In reply to Hi Mikko , by rahul.singh@ra…

* localhost changed with IP

* localhost changed with IP

Unhandled exception. Service started: http://192.168.100.88:648
System.Net.Http.HttpRequestException: Connection refused

OS Details:

uname -a
Linux ip-192-168-100-88.ap-south-1.compute.internal 4.14.146-119.123.amzn2.x86_64 #1 SMP Mon Sep 23 16:58:43 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

rahul.singh@ra…

6 years 4 months ago

In reply to * localhost changed with IP by rahul.singh@ra…

Hi Mikko

Hi Mikko

It will also support IPV6 as server .

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

Linux gurux-test 3.10.0-1062.9.1.el7.x86_64 #1 SMP Fri Dec 6 15:49:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

We'll modify the Gurux.DLMS.AMI so you can try to connect using curl and get some info.
I'll send more info in the following hours.

BR,
Mikko

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

I believe that this is now solved. Get the latest version.
I don't know why it was working on a few Centos and failed for some.

If you try to access Gurux.DLMS.AMI from the other PC you must modify firewall settings.
You can try get info from other pc with default browsers.

http://IP_ADDRESS/api/info

BR,
Mikko

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

Now I know the reason for this. It was a timing issue. For some reason, REST was not SOMETIMES up and running. We added a small delay before starting reader service and now it's working without problems.

BR,

Mikko

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

We have found other issues from the JSON serializer. We have made a few changes and release a new version tomorrow.

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

Hi Mikko ,

Hi Mikko ,

Sorry for delayed response .
Was unable to Reply & Test yesterday.
Will test and update you .

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

Hi Mikko ,

Hi Mikko ,

Sorry for delayed response .
Was unable to Reply & Test yesterday.
Will test and update you .

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Rahul,

Hi Rahul,

We found another problem. .Net Core JSON serialization is not work correctly for all the data.
You saw this problem with GXDLMSDirector in your previous posts.

We are fixing this and try to release a new version latest tomorrow.

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi Rahul, by Kurumi

Ok Thank you

Ok Thank you

rahul.singh@ra…

6 years 4 months ago

In reply to Ok Thank you by rahul.singh@ra…

Hi Mikko

Hi Mikko

There is one more observation

1. Socket state is listening even after closing application.

and Thanks this version is working on my Centos without any exception.

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,
There are new versions from Gurux.DLMS.AMI and GXDLMSDirector.
We have change data structure so .Net Core 3.1 for Linux can handle it.

About socket listening. Are you talking from the socket that meter opens?

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

No . Socket where GuruX is

No . Socket where GuruX is listening (1001)

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

How you close the app and how you can see that socket is up? We'll check this.

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

We are terminating app with

We are terminating app with (ctrl+C).

Checking port status with
netstat -apn | grep "1001"

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi,

Hi,

You are right and we know why this is happening. We'll fix this for the next release.

BR,
Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi, by Kurumi

Thanks

Thanks

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Rahul,

Hi Rahul,

This is fixed.

BR,

Mikko

rahul.singh@ra…

6 years 4 months ago

In reply to Hi Rahul, by Kurumi

Thanks Mikko . for your

Thanks Mikko . for your continuous support :)

  • 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