C
C#3mo ago
MrWholesome

How can I debug a program working fine on my development PC vs the deployment PC?

I've made an application with various functions which improve my workflow on my work PC. My program works flawlessly when not connected to the company VPN but fails every time once connected. How can I debug this without a network inspection tool or admin rights?
10 Replies
Angius
Angius3mo ago
Add logging
Lex Li
Lex Li3mo ago
.NET Framework/.NET has internal tracing that might give you some hints. Search about System.NET tracing.
Pobiega
Pobiega3mo ago
Add logging via serilog and you can very easily customize what outputs the logging system produces, from console log to files to pushing to an external log aggregator.
OkOk
OkOk3mo ago
I think the only problem a network change will do is that your companys router firewall is preventing traffic to your computers specified port I would ask someone on the network team if the firewall is allowing incoming traffic to some range of ports, then i would pick one of those to host my application on
MrWholesome
MrWholesome3mo ago
How can I specify port and how can I check what port it's currently using?
OkOk
OkOk3mo ago
Don't worry that can be googled
MrWholesome
MrWholesome3mo ago
I'm asking an expert because I've already googled it. I can't tell what port it's currently using using any of the network commands on windows that I can find and, apparently .net apps can't bind to a specific local port, only an external port. Does that match what you know?
OkOk
OkOk3mo ago
Hard to call oneself an expert in random help-questions but I will try to help This is the info i tried to gather: So you are writing code for a .net app like an API, this project template will come with a LaunchSettings-file where it specifies the localhost port that it will open to receive requests Search the whole solution for the word "Localhost" and you will find the ports it uses and you can change that to whatever is allowed If you want to double-check that the running software uses this port you can open the windows preinstalled software "Resource Monitor" - here you can see what port your process is using for incoming calls and see if your your computer-firewall is blocking this connection
No description
OkOk
OkOk3mo ago
The information you got about not binding to local ports - I would discard that as faulty or a misunderstanding
Lex Li
Lex Li3mo ago
".net apps can't bind to a specific local port" is not very true. Developers can definitely force the socket client to bind to specific ports when sending things out, but just not best practice. "any of the network commands on windows"? Did you try netstat -aon? If you do know the client/server ports (TCP/UDP), a tool like Wireshark can reveal all packets to you.