Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

windows - Self-contained win-x64 executable AggregateException: Connection actively refused

I am trying to publish a self-contained executable for Windows. When I try to run the executable via a privileged powershell (or cmd) window, I get the following error:

Unhandled exception. System.AggregateException: One or more errors occurred. (No connection could be made because the target machine actively refused it.)
 ---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it.
 ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   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)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at myProgram.Client.postClaim(Claim Claim, Byte[]& var1, Byte[]& var2, Byte[]& var3)
   at myProgram.Program.Main(String[] args)

If it's relevant, on that line, I am connecting to a tomcat-hosted server on another machine.

What is strange, is that when I publish a non-standalone app, I don't get the error. The application runs successfully to completion. I also don't get the error when I run the program in debug mode from within visual studio. Additionally, I've built a self-contained executable for linux-x64, and that was able to run successfully from a linux machine.

I've tried disabling Windows Defender firewall, and similar programs. However, since the program runs fine in those other cases, I'm thinking it's not a firewall issue.

Is there a problem with self-contained executables? Is there something I'm missing before running the self-contained executable on windows? I'm at a loss on how to solve this issue.

question from:https://stackoverflow.com/questions/65832739/self-contained-win-x64-executable-aggregateexception-connection-actively-refuse

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...