Litium App Direct Payment - The SSL connection could not be established, see inner exception

I’m trying to install the pseudo payment provider (Same thing happends with delivery), but get an SSL connection error when trying to add the config file.

I’m running Litium on https://localhost:44384/ (started from Visual studio) with a valid development https cert, and added 44388 as port in the docker-compose.yaml for direct-payment.
The installation of the addon is sucessful. But the error happens when i try to add the config file and klick save.
Do i need to have the config file in a special location? Right now it’s in ./data/direct-payment/config
I can’t find any good logs. Looked both in the litium log and in ./data/direct-payment/logs but can’t see anything relevant. Only this below

2021-10-04 14:06:37.4503 [App:01] [] [ERROR] [] Litium.Connect.Payments.Communications.Litium.ConnectPayments.IRegistrationService - Cannot assign requested address (localhost:44384) System.Net.Http.HttpRequestException: Cannot assign requested address (localhost:44384)
—> System.Net.Sockets.SocketException (99): Cannot assign requested address
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|283_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.DefaultConnectAsync(SocketsHttpConnectionContext context, CancellationToken cancellationToken)
at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.ConnectAsync(Func3 callback, DnsEndPoint endPoint, HttpRequestMessage requestMessage, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
at Litium.Connect.Payments.Communications.Litium.LitiumAuthenticationDelegatingHandler.GetOAuth()
at Litium.Connect.Payments.Communications.Litium.LitiumAuthenticationDelegatingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.SendAsyncCore(HttpRequestMessage request, HttpCompletionOption completionOption, Boolean async, Boolean emitTelemetryStartStop, CancellationToken cancellationToken)
at Litium.Connect.Payments.Communications.Litium.ConnectPayments.ConnectPaymentsClient.PaymentProvider_GetAsync(String id, String api_versionQuery, String api_versionHeader, CancellationToken cancellationToken)
at Litium.Connect.Payments.Communications.Litium.ConnectPayments.RegistrationService.<>c__DisplayClass3_0.<g__TryUpdatePaymentProvider|0>d.MoveNext()
— End of stack trace from previous location —
at Litium.Connect.Payments.Communications.Litium.ConnectPayments.RegistrationService.RegisterAsync(PaymentProvider paymentProvider)
at Litium.Connect.Payments.Infrastructure.PaymentProviderHostedService.StartAsync(CancellationToken cancellationToken)

Litium version: 8

Don’t use “https: // localhost: xxxx” as the domain name, instead use ex localtest.me addresses that were set up in the step with shared resources. If you use localhost, the application in the container tries to call itself instead of Litium, which means that the connection will never work. 443xx ports are reserved for IIS Express and they do not allow you to use any other domain name than just localhost.

Is there any more documentation on how to get customer.localtest.me:45678 to work?

Or should that “just work” if the docker file is correct and customer.localtest.me is added to domain names in Litium?
Or should it be hosted in the iis manager for that to work?

I managed to run it on iis so I have not tested any other way.
Take a look here:

Can you please provide more information about this for developers?

It’s no problem to host it in IIS, but I only manage to get it to work when i publish the site to IIS.
And we can’t do that as developers, we have to be able to debug and reload on every build. Not after every publish.

I create a site on iis and point it to the MVC folder as we did in previous versions but for that approach iis needs a web.config so you need to generate a web.config for iis to understand. But of course now you have more options with .net core and kestrel so you can run without iis also.

In the above link you can find the subpage Development-time IIS support in Visual Studio for ASP.NET Core | Microsoft Docs that describe how you setting up IIS, adding the workload for Visual Studio that is needed and how to create the IIS launch profile to make it work for “Start debugging”

Thanks for the help. That Development time IIS support really helped.

I have figured out our problem now. Apperently our internal IT is doing something (know idea what yet), but it’s messing with docker, so the app urls wont work and host.docker.internal can’t be reached. So this is causeing alot of confuson.
But i got it working without any issues on a computer not connected to our company. So I will talk to them and see whats going on.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.