Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Connection reset when calling from within IIS

Aperta
#1,666 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp

Direzione di ricerca

Inizia riproducendo il reset della connessione dell’applicazione ASP.NET legacy sotto IIS, confrontandolo con l’applicazione web di test, il servizio Windows e i casi SSH dalla riga di comando. Esamina le modifiche menzionate a applicationHost.config e web.config e raccogli informazioni sufficienti per distinguere il contesto IIS dai percorsi funzionanti. Il lavoro è completato quando è stata identificata una causa riproducibile o una diagnosi utilizzabile per il reset.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

We have a legacy asp.net application that uses Renci.SshNet to upload files to a linux box. It's been working for years. We upgraded the version of ssh on the linux machine, and had to upgrade our application to the latest version of Recni.SshNet... 2025.0.0. Now, the application refuses to connect to the linux box. The only error we receive is "connection reset". The same error is reported on the server, with no additional information.

For credentials, we're using a .pem file located in a directory off the root of drive C. I've tried a dozen different permission combinations on this file. And I believe it's not a file permissions problem. The asp.net application that fails is able to read the contents of the .pem file.

I copied the code over to a test web application. And the code works there.... same code, same server, same application pool, same credentials, same file to upload, same destination server.

We also have similar code in a Windows service that uses Renci.SshNet to download the same file from the same linux machine. That code works.

I tried connecting from the windows iis server using a command line ssh with the same credentials. That works. I also tried to call the same command line ssh command from within the legacy asp.net application. That also fails with connection reset.

I can sometimes make this work by playing with various settings in applicationHost.config and web.config. Removing a seemingly unrelated module made it suddenly start working. It worked for a few minutes with maybe half a dozen successful upload attempts. So I put the module back in to verify that this was in fact the cause. And the upload quit working. So I took it back out, and it stayed not working. Sometimes I can get this same behavior by adding, removing, or changing certain entries in applicationHost.config or web.config. But it never sticks. After a few uploads, it stops working again. iisreset between every config file change. iisreset has no effect on whether this works or not.

I believe I'm chasing some kind of race condition in the unmanaged code in IIS. When I make a change to one of the config files, I think it forces iis to reload something in memory, allowing Renci.SshNet to work for a few minutes. Then it does something or loads something else which causes it to fail again.

I'm 100% stuck. At this point, my options are to redesign the file upload so that the asp.net application asks the windows service or something else outside the context of iis to do the upload for it. Or I have to remove Renci.SshNet and use some other library.

The main problem is that I have zero visibility. There's no information in any of the error messages to help me identify the root cause. I have to simply guess, again and again, and hope that I guess right in finding the cause. Can you offer any kind of assistance to get this working?

Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sshnet/SSH.NET

Tutte le issue di sshnet/SSH.NET

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.