TCP/IP Connection call from External Csharp Dynamic Link Library blocked by Firewall

I think most of TCP/IP Connection problem deals with exe files on the net. I could not find any straight forward answer for my specific problem for the case of using the external Dynamic Link Library building the TCP/IP connection.

I build a simple Server and Client application for remote communication purpose. They are written in c sharp dll.

The third party exe will use my custom dynamic Link library to call the TCP/IP connection inside my dll library (the external DLL was written from C Sharp) for both server and client application.

For your information, I do not have any access to change anything in that third party exe file but only I can change anything in my Dynamic Link Library. The dll also use only one port for communication.

Everything works fine when I switched off the Firewall on my Public network. However, as soon as I switch on the firewall, the connection can not be made any more.

  1. I tried to create inbound rule to allow a specific port in my firewall, used by my TCP/IP application. But this approach does not work although it should work. Even I created outbound rule to allow the same port. But it never works.

  2. I also tried to grant the admin right by setting this on the manifest file inside my dll file programmatically. But again nothing happens.

requestedExecutionLevel level="requireAdministrator" uiAccess="false"

  1. I started the main exe file with admin right. But this also does not work.

Because the dll file is calling the TCP/IP connection, I can not set the program rule for the dll file in my firewall. I think only exe file can use the programme rule in the firewall.

So I tried to build the equivalent standalone exe file instead of my dll file. I have created new inbound rule for Program allowing the standalone exe file in my firewall. Everything worked perfectly again. Both server exe and client exe app can communicate without any problem.

In spite of the fact that using the standalone exe file can work, I have to use dll file and can not use the exe file for this application. So far only working solution for the dll file is switch off the firewall. What would be some work around or tricks for my specific firewall problem with this dll file?

Kind regards.