5

Historically I've always uploaded my website via FTP since my server does not have front page extensions and nor will it.

Using the latest release of Visual Studio 2012 (11.0.51106.01 Update 1) (although I think this issue is for all of 2012), I cannot publish my website!

The error message is

2>Unable to add 'file' to the Web site. FTP Passive mode is not available

I will also point out that my connection validates so I don't think the error message is anything but clear and meaningful!

So, I have 3 questions.

  1. Is this something I'm doing wrong or a fault with Visual Studio 2012?
  2. Should I be trying to do this via passive mode or should I be updating my web server to enable "active mode"?
  3. Is FTP still an acceptable method or should I be investigating the Web Deploy option?
Dave
  • 8,163
  • 11
  • 67
  • 103

6 Answers6

13
  1. Open your publish profile Properties\PublishProfiles\your_profile_name.pubxml

  2. Add <FtpPassiveMode>False</FtpPassiveMode> to <PropertyGroup>

  3. Save file and publish again.

Anri
  • 6,175
  • 3
  • 37
  • 61
  • Setting False in the pubxml file fails on mine. What I get is: Warning 1 The element 'PropertyGroup' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003' has invalid child element 'WebPublishMethod' in namespace 'http://schemas.microsoft.com/developer/msbuild/2003'. List of possible elements expected: 'Property, AllowUnsafeBlocks, AppConfigForCompiler, ApplicationIcon, ApplicationRevision, ApplicationVersion, AppDesignerFolder, AspNetConfiguration, AssemblyKeyContainerName, ... (there's a lot more) – joelc Jun 14 '13 at 03:34
  • Technically - warning is not an error, it's not critical and may have not relevant reasons. Does publish actually fail when you you do it? – Anri Jun 14 '13 at 03:38
  • It fails. 2>------ Publish started: Project: , Configuration: dev Any CPU ------ 2>Connecting to ftp://... 2>Copying all files to temporary location below for package/publish: 2>obj\dev\Package\PackageTmp. 2>Deleting existing files... 2>An error occured trying to enumerate the contents of folder ''. Cannot connect with active FTP. Please try using passive FTP. 2> ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ========== ========== Publish: 0 succeeded, 1 failed, 0 skipped ========== – joelc Jun 14 '13 at 05:44
  • Well, as you see, your error message is different the the one in OP's question. It might be your firewall or network settings. Try connecting with any other ftp client in Active mode. – Anri Jun 14 '13 at 06:18
  • FileZilla with active FTP works just fine. I see your point about being off-topic - thanks. – joelc Jun 14 '13 at 14:58
  • Created another question on this topic. http://stackoverflow.com/questions/17101779/vm-on-azure-passive-ftp-wont-work – joelc Jun 14 '13 at 15:33
  • Although my work around works, this is clearly the better answer! – Dave Aug 13 '13 at 07:42
4

As a workaround, publish the site to a filesystem (ie, save it locally), and then use another FTP client to transfer it. It's not great at all, but, if you're desperate and out of options then it may be a solution, however temporary.

As an actual fix, it's down to the server to enable this. In my case, it turned out to be a firewall problem (gave incoming permissions to FileZilla Server) and not using a custom port range in FileZilla server (under passive)! This suggests it was a port issue!

However, this doesn't explain why you can or can't turn off/on passive mode in VS 2012 but could in earlier releases.

Dave
  • 8,163
  • 11
  • 67
  • 103
4

You can also do this (I was getting the same error as yours):

1 - Build > Publish 'project'.

2 - Uncheck the Passive Mode.

enter image description here

A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128
0

It should work after 5 simple steps (IIS7.5):

  1. Make sure passive mode is selected
  2. Make sure to configure data channel port range in IIS application FTP Firewall Support section (e.g. 5000-6000)
  3. Make sure that port range 5000-6000 is open on the firewall (Allow inbound connections on port range 5000-6000)
  4. net stop ftpsvc
  5. net start ftpsvc
Michal B.
  • 5,676
  • 6
  • 42
  • 70
0

In my case, after I checked the log file, it suggested that the deployment kept timing out. I restarted my computer and that error message is gone.

Auguste
  • 2,007
  • 2
  • 17
  • 25
-1

If you have acces to the server. You have to add the svchost.exe to the "Allowed Programs" in Windows Firewall.

Look at this film. Its at the end. youtube film

This worked for me.

StefanHa
  • 727
  • 8
  • 19