FTP Publish Error in Visual Studio – An unknown WinINet error has occurred (code 12113) – How to fix it

Microsoft .NET Core 1.0.0 VS2015 Tooling Preview Update 2 fails to install with Error 0x81f4000: how to fix it

A rather common issue that you can experience while working with Visual Studio – be it 2010, 2013, 2015 and even 2017 – is the following error appearing on your Output window right after you try to publish your project to a remote FTP location:

Unable to add ‘file.ext’ to the Web site. An unknown WinINet error has occurred (code 12113).

This usually means that there are networking/connection issues between your Visual Studio development machine and the remote FTP server. To fix the issue you can try one of the following methods:

Enable the FTP Passive Mode

The first thing you can try is to enable FTP Passive mode on your publish settings configuration, so FTP will be able to work even behind NAT routers or dedicated firewalls. To change your publish settings, right-click to the project node in Solution Explorer, then select Publish… to access the modal window. Select your publishing template from the drop-down list, navigate to the Connection tab and activate Passive mode in the following way:

FTP Publish Error in Visual Studio - An unknown WinINet error has occurred (code 12113) - How to fix it

In most cases this will enough. However, chances are that your FTP server is unable to support Passive mode. If that’s the case, your Output window will show the following error:

Unable to add ‘file.ext’ to the Web site. FTP Passive Mode is not available.

If you get this and are unable to set your FTP server to allow Passive mode connections, keep reading: the same goes if you are unable to fix your issue this way.

Allow inbound connections for Visual Studio

The next thing you can try is to configure your built-in Windows Firewall (or any other firewall you have replaced it with) to accept inbound connections to the Visual Studio main executable file, which is the devenv.exe (usually located in  , where XY.Z are the Visual Studio build numbers (find yours here). You can do that by creating a custom inbound rule in your firewall pointing to that file.

If you’re using Windows Firewall, here’s how you can do that:

  • Open the Control Panel by right-clicking to the bottom-left Windows icon.
  • Select the Windows Firewall icon.
  • Select Advanced Settings from the left navigation panel.
  • Add a new Inbound Rule for the devenv.exe executable file (check the full path here).
  • In the Advanced menu, activate the rule for all profiles (Public, Private and Domain) and also be sure that Allow Edge Traversal is selected in the appropriate dropdown list as in the screenshow below:

FTP Publish Error in Visual Studio - An unknown WinINet error has occurred (code 12113) - How to fix it

That should do it. However, in case you still have issues, keep reading.

Deactivate Port-Blocking Software

If you’re still getting that error – or are otherwise unable to estabilish a proper FTP connection – after the above workarounds, it probably means that there’s something in your system which is either blocking or scanning your port(s), thus preventing VS from properly communicating with the server. This is a list of the software you could try to temporarily disable in order to overcome your issue:

  • Antivirus software such as Kaspersky, BitDefender, Avira, AVG
  • Web Content filters such as Kerio Control
  • Web Protection Suites such as Symantec, McAfee and so on
  • Internet proxies and/or software TCP/IP filters
  • Windows Firewall (or other Firewall software)

Be sure to promptly reactivate them right after you find the culprit – and/or execute your upload. If the issue is still there, it could be also wise to perform a virus/malware scan, just in case.

That’s it for now: happy publishing!

 

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies. Microsoft MVP for Development Technologies since 2018.

View all posts by Ryan

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.