Localhost connection not getting in Windows docker container using docker desktop

I facing lost connection local host in the docker desktop . I am using docker desktop windows
Using .net framework 4.5
Using visual studio 2022
Docker version 23.0.5, build bc4487a

When i am trying to run in local host first login page as like

http://localhost:52947/Data_Service.asmx

After login missing the port

http://localhost/Data_Service.asmx/mLoginEncrpt

This is happening in the login time i am not getting any log details. But when i am trying to connect with the container id i am getting the result success. but local host cant connect .
Is there anybody face these problem

I got this same error too. but I can’t resolve it ,so please someone replay for how to solve

hi @vishnuvs6810 could try using nginx to solve this issue

Docker or Docker Desktop will not “steal” your port number. It is an application issue. Your app probably has a config either in file or in a database that doesn’t set a port number so when it redirects or shows a link it will not add the port number or you just build the URL based on what port the app is listening on. If it works with an IP address, that is also probably some logic implemented in the application which we know nothing about. Sometimes localhost handled differently allowing you to access an admin page.

When you build URLs in the app , you should not assume that the port number on the client side will be the same as the port the app is listening on. The client could access the website throigh a proxy server or just forward the request from a different port like probably in your case.

If you need more help, please, share more context, how you build the URL if you developed the and how you start the container.

Use code blocks for sharing code as explained here: How to format your forum posts

There is noting port or other configuration in the backend side .i am using old version of .net framework 4.5 .i am attaching the docker file for further clarification .

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
ARG source
WORKDIR /inetpub/wwwroot
COPY ${source:-bin/app.publish} .

Sorry, but it doesn’t help me. I don’t use .NET and I know nothing about the app. If there is no configuration for the port, maybe that is the problem. If the app assumes it will run on the default port. What you need to find out what generates that link to redirect after login. MAybe the problem is on the client side and the HTML form is wrong. Either way, Docker doesn’t do anything with the port itself, so if the issue is related to Docker, we need to know how that URL is generated in the application.

Also

Thank you