Solved

c# ssh tunnel with plink

Posted on 2014-11-26
4
386 Views
Last Modified: 2015-02-16
I have a C# web application that runs on Windows Server 2008 r2 and .NET 4. I have an SSH tunnel set up that runs via plink and stays running via AlwaysUp.

This web app was previously running on Win2k Server with .NET 1.1 and the tunnel would stay open as long as the server was running.

However, I've noticed now on the new server the web app can not maintain the connection. If I touch the web.config file the web app can use the connection and all is well. However, after about 2-3 minutes the connection is still alive on the server, but the web app won't connect until I touch the web.config again.

I'm not much of hardware person so I'm hoping maybe there is a setting on the server or within the web app that I am missing or something has changed in .NET idk I'm at a loss.
0
Comment
Question by:YPU
  • 2
4 Comments
 
LVL 23

Expert Comment

by:David
ID: 40469933
Not my area, yet I wonder why you use plink (for batch-style commands); and at least for the other SSH connections I can set a keepalive parameter in my host's ssh_config.  HTH
0
 
LVL 29

Expert Comment

by:serialband
ID: 40474908
With Openssh, you could supply the "-o ServerAliveInterval=120" when you call the command.  Unfortunately, plink doesn't allow options to be passed through.  You'll have to set it in your config file.

Run the following to add the interval to your account's client configuration file.
echo "ServerAliveInterval 120"  >>  ~/.ssh/ssh_config
0
 

Accepted Solution

by:
YPU earned 0 total points
ID: 40603754
I solved this issue on my own. I found that I was not properly closing the connection to the mysql database and there were too many connections to the db, causing the db to disallow any new connections. I patched the code and restarted the db and all is well.
0
 

Author Closing Comment

by:YPU
ID: 40611886
Problem solved. Make sure the database you are trying to connect to has available connections.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Webform example, External Authentication Services, OAUTH, asp.net 4.6.2 1 34
Code works but it's slow 28 71
use of unassigned local variable 'id' 6 41
C# bracket error 3 33
Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question