I have a C# (WPF) application (my own creation) that needs to open a port on the computer. This means that it requires administrative privileges to run. The app is currently unsigned and every time I run it it brings up the UAC prompt inquiring whether I want to let this program from an unknown publisher make changes to my computer.

I was wondering why Firefox doesn't trigger a UAC warning. After all, it too must open a port to be able to access the internet. Is it because Firefox is a native app?

link|improve this question
Are you sure the UAC prompt is because your program is trying to "open a port" and not because it's doing something else? If you disable the firewall, do you still get a UAC prompt? – techie007 Sep 7 '11 at 3:33
@techie007: The UAC prompt is because I've set requestedExecutionLevel level="requireAdministrator" in the app manifest. I had to do this because I use ServiceHost.AddServiceEndpoint to open the port, and this call fails unless the app is run as administrator. – Praetorian Sep 7 '11 at 5:41
Ahhhh.. Have you seen this: social.msdn.microsoft.com/Forums/en/wcf/thread/… ? Perhaps you're better off asking "how to use ServiceHost.AddServiceEndpoint without impersonation" over at StackOverflow? – techie007 Sep 7 '11 at 5:54
feedback

2 Answers

up vote 2 down vote accepted

Your program opens a port for listening for incoming connections. Firefox does not do that – it connects to a server.

Outgoing connections do use an ephemeral port locally too, but it is opened implicitly for just that specific connection (see stateful firewall).

link|improve this answer
feedback

My guess is... the outgoing ports are open by default on the Windows Firewall; therefore, no request to open those ports is necessary.

link|improve this answer
So if I connect to port 80 I won't need admin privileges? – Praetorian Sep 7 '11 at 2:05
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.