deployment – Visual Studio ClickOnce FTP publish suddenly fails after years of working – “too many connections” due to unclosed FTP connections


Background

I’ve been successfully publishing a Windows Forms application via ClickOnce to the same FTP server for years without any issues. About 2-3 months ago, this suddenly stopped working. No changes were made to our development environment, hosting, or application configuration.

The Problem

Visual Studio fails to publish via FTP with multiple “550” errors. After extensive troubleshooting and dozens of failed publish attempts, our hosting provider investigated and found that Visual Studio is not closing FTP connections properly. Since our hosting plan limits us to 8 simultaneous FTP connections, the publish process exhausts this limit and fails.

This is affecting our entire development team – the issue occurs on:

  • ✗ All developer machines (5+ different PCs)
  • ✗ Multiple Visual Studio versions (2017, 2019, and 2022)
  • ✗ Different Windows versions (Windows 10 and 11)
  • ✗ Different network connections

Error Messages

During ClickOnce publish, I get cascading errors like these:

Error copying file ‘C:[LocalPath]\GestionDePoligonos\bin\Debug\app.publish\Application Files\GestionDePoligonos_1_0_5_3\DevExpress.RichEdit.v19.1.Export.dll.deploy’
to ‘ftp://[ftp.domain.com]/[path]/Application Files/GestionDePoligonos_1_0_5_3/DevExpress.RichEdit.v19.1.Export.dll.deploy’.
Can’t add ‘Application Files/GestionDePoligonos_1_0_5_3/DevExpress.RichEdit.v19.1.Export.dll.deploy’ to the Web site.
Can’t change directory to Application Files/GestionDePoligonos_1_0_5_3: No such file or directory (550).
Error copying file ‘C:[LocalPath]\GestionDePoligonos\bin\Debug\app.publish\Application Files\GestionDePoligonos_1_0_5_3\System.Memory.dll.deploy’
to ‘ftp://[ftp.domain.com]/[path]/Application Files/GestionDePoligonos_1_0_5_3/System.Memory.dll.deploy’.
Can’t add ‘Application Files/GestionDePoligonos_1_0_5_3/System.Memory.dll.deploy’ to the Web site.
Ready to proceed (200).
Error copying file ‘C:[LocalPath]\GestionDePoligonos\bin\Debug\app.publish\Application Files\GestionDePoligonos_1_0_5_3\DevExpress.XtraCharts.v19.1.dll.deploy’
to ‘ftp://[ftp.domain.com]/[path]/Application Files/GestionDePoligonos_1_0_5_3/DevExpress.XtraCharts.v19.1.dll.deploy’.
Can’t add ‘Application Files/GestionDePoligonos_1_0_5_3/DevExpress.XtraCharts.v19.1.dll.deploy’ to the Web site.
Can’t change directory to Application Files/GestionDePoligonos_1_0_5_3: No such file or directory (550).

The errors vary between:

  • No such file or directory (550) – for most files
  • Ready to proceed (200) – for some files that manage to upload before hitting the connection limit

Hosting Provider’s Diagnosis

After multiple support tickets, our hosting provider (who has been excellent throughout this issue) confirmed:

“The issue is that Visual Studio is not properly closing FTP connections after each file transfer. Your account has a limit of 8 simultaneous FTP connections, and Visual Studio is keeping all connections open, quickly exhausting this limit. This is a Visual Studio bug – you need to contact Microsoft support for a solution on how to configure Visual Studio to properly close FTP connections.”

What DOES Work

  • ✅ Publishing to a local folder: Works perfectly on all machines
  • ✅ Uploading via FileZilla: Can upload the entire published folder without any issues
  • ✅ FTP access: No problems connecting via any other FTP client from any machine

What DOESN’T Work

  • ❌ Direct FTP publish from Visual Studio (fails after uploading a few files)
  • ❌ Creating new publish profiles
  • ❌ Different Visual Studio versions (2017, 2019, 2022)
  • ❌ Publishing from different computers
  • ❌ Fresh Visual Studio installations

Environment Details

  • Visual Studio: 2017, 2019, and 2022 (different developers using different versions)
  • Affected Machines: All development team PCs (5+ machines)
  • Project: Windows Forms App (VB.NET, .NET Framework)
  • Publishing: ClickOnce via FTP
  • FTP Server: Standard shared hosting (8 connection limit)
  • Timeline: Worked perfectly for years → Stopped working 2-3 months ago

Attempted Solutions

Over the past few months, our team has collectively tried:

  1. Multiple Visual Studio “fixes” on all machines:
  2. Registry modifications (looking for FTP connection settings).
  3. Project file modifications
  4. Complete Visual Studio reinstallations on multiple machines

The Question

How can we force Visual Studio to properly close FTP connections during ClickOnce publishing?
We’re looking for:

Hidden Visual Studio settings that control FTP connection pooling
MSBuild parameters that might help
Registry keys that control .NET FTP behavior
Any workaround that doesn’t involve manual FTP uploads

This seems to be a long-standing Visual Studio bug (found similar reports from VS2010 era), but we desperately need a solution as it’s severely impacting our deployment workflow across the entire team.

If you’ve experienced this issue, please share:

  • What version of Visual Studio you were using
  • When the issue started for you
  • Any workarounds you’ve discovered

I’ll update this post with any working solutions found.

Leave a Reply

Your email address will not be published. Required fields are marked *