Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Connection reset when calling from within IIS

未关闭
#1,666 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
csharp

调研方向

首先,在 IIS 下复现旧版 ASP.NET 应用程序的连接重置,并将其与测试 Web 应用程序、Windows 服务和命令行 SSH 场景进行比较。检查提到的 applicationHost.config 和 web.config 更改,并收集足够的信息,以区分 IIS 上下文与正常工作的路径。完成的标准是确定一个可复现的原因或针对该重置的可执行诊断。

由索引模型根据 Issue 内容生成。

描述

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?

主要语言
C#
星标
4.4k
派生
993
平均合并
9 天 21 小时
30 天内合并 PR
1

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

sshnet/SSH.NET 的其他 Issue

查看 sshnet/SSH.NET 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。