myrtille icon indicating copy to clipboard operation
myrtille copied to clipboard

Myrtille requires tcp port 80 to be free.

Open romanad opened this issue 3 years ago • 5 comments

Dear friend, I noticed that the Myrtille requires TCP port 80 to be free. If I turn on the Apache server on port 80, then Myrtille does not work and I get the following error in the logs:

"2022-02-23 00:55:30,808 [11] ERROR System.Diagnostics redirection [(null)] - Failed to retrieve service process identity, remote session cdbf91dd-6173-400a-820b-67486d157899 (System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:80/Temporary_Listen_Addresses/27559611-8a30-4cef-ac61-97438f4d5f18/ because TCP port 80 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process at System.Net.HttpListener.AddAllPrefixes() at System.Net.HttpListener.Start() at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen() --- End of inner exception stack trace ---"

How to fix this issue if I want to use TCP port 80 for Apache web-server with Myrtille simultaneously ?

romanad avatar Feb 23 '22 00:02 romanad

The same port can't be used at the same time by 2 different applications. TCP 80 is the standard port for HTTP servers, so you have to configure IIS (used by Myrtille) and Apache on different ports (i.e.: Apache port 80 and IIS port 81). The same goes for HTTPS (i.e.: Apache on standard SSL port 443 and IIS port 444). See https://docs.microsoft.com/fr-FR/iis/configuration/system.applicationhost/sites/site/bindings/

Then add this port to the URL to access Myrtille (i.e: http://server:81/myrtille, https://server:444/myrtille) or use a reverse proxy like Nginx or ARR for an automatic redirect on these ports (IIS URL rewrite can also do that).

cedrozor avatar Feb 25 '22 14:02 cedrozor

Thank you for the answer. Actually I do understand that I can't use the same port at the same time by 2 different applications. The problem is that even if I use only 8800 for http access in IIS binding settings I still keep getting an error in Myrtille logs that 80 port is being used but the Myrtille main page is loading fine. But if I press connect I'm getting nothing but an error in logs that 80 port is being used : ) If I disable Apache web server that's on 80 port the problem disappears : ) So it seems for me that Myrtille is somehow hiddenly requires to have TCP port 80 being free ^^/.

Please take a look at attached screenshots.

https://i.imgur.com/j8oi1A9.jpg https://i.imgur.com/6e7BoQb.jpg

romanad avatar Feb 25 '22 15:02 romanad

"2022-02-23 00:55:30,808 [11] ERROR System.Diagnostics redirection [(null)] - Failed to retrieve service process identity, remote session cdbf91dd-6173-400a-820b-67486d157899 (System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:80/Temporary_Listen_Addresses/27559611-8a30-4cef-ac61-97438f4d5f18/ because TCP port 80 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process

The "process identity" is retrieved by the remote session process service, which is listening on port 8080: https://github.com/cedrozor/myrtille/blob/b99671589ad0c18f7ccb0878d08e05bcb9cb15c6/Myrtille.Web/Web.Base.config#L127

This service has duplex communication (2 ways), so the "temporary listen address" is bound for callback. This is the pitfall there, it looks like .NET uses the port 80 (which is also the default port for IIS) for callback communication.

Following this hint: https://stackoverflow.com/questions/2904840/wcf-test-client-service-failed-to-invoke/2910182#2910182, you have to set clientBaseAddress in the binding configuration (web.config):

<binding name="wsDualHttpBindingCallback" clientBaseAddress="http://localhost:8800/Callbacks/" ...

From your screenshot, I see you have IIS listening on port 8800, but you can use another port for callbacks.

cedrozor avatar Feb 27 '22 15:02 cedrozor

Thank you Sir for such a definitive explanation. But this one is the tough issue. I have successfully changed the "Web.config" file (see screenshots) but now I keep getting new error:

Web.configMyrtille.Web.SendInputs.Page_Load(Object sender, EventArgs e)) 2022-06-03 15:33:14,566 [21] ERROR System.Diagnostics redirection [(null)] - Failed to retrieve service process identity, remote session c4c67d8e-c298-448e-b18b-4bae48be81bb (System.ServiceModel.AddressAccessDeniedException: HTTP could not register URL http://+:8800/Callbacks/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details). ---> System.Net.HttpListenerException: Access is denied

Could you please provide some direction where to dig now ...

Log and screenshots are attached. Myrtille.Web.log 8800 8801

romanad avatar Jun 03 '22 12:06 romanad

run cmd as Administrator then run: netsh http add urlacl url=http://+:8801/Callbacks/ user=Everyone listen=yes

Viyeuxa avatar Aug 13 '22 02:08 Viyeuxa

run cmd as Administrator then run: netsh http add urlacl url=http://+:8801/Callbacks/ user=Everyone listen=yes

Thank you very much my friend! It works like a charm : )

romanad avatar Oct 10 '22 01:10 romanad