Today I was moving some of my Windows Azure Web Sites to another region so both the site and storage were in the same data center. Sadly moving a site still means (re-) creating the site in the correct region. The easiest way is to keep the existing site up and use another name for the new one (like Troy Hunt did). By using this approach, you only have to redeploy the site, change DNS records and wait for it to propagate. A day or so later, when all DNS changes went around the globe), you just delete the old site and done.
But as I was using some particular names and wanted to keep those for clarity, I decided to just delete the site and recreate in the correct region. The deletion and recreation is very fluid, but the deployment part is where I got into troubles. Trying to deploy from WebMatrix gave me a connection error and when looking more into detail I came up with following stacktrace:
Could not publish the site. Could not publish the site. Error detail: Could not connect to the remote computer ("***.scm.azurewebsites.net"). On the remote computer, make sure that Web Deploy is installed and that the required process ("Web Management Service") is started. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_DESTINATION_NOT_REACHABLE. at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request) at Microsoft.Web.Deployment.AgentClientProvider.PerformHeadRequestHelper(Boolean getVersionInfo, Version& maximumSupportedVersion, Version& minimumSupportedVersion) at Microsoft.Web.Deployment.AgentClientProvider..ctor(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext, String serverVersion) at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject, String serverVersion) at Microsoft.Web.Deployment.DeploymentManager.CreateDestinationObject(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject, String serverVersion) at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions) at Microsoft.Web.Deployment.DeploymentObject.SyncTo(String provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions) at Microsoft.Web.Deployment.DeploymentObject.SyncTo(DeploymentWellKnownProvider provider, String path, DeploymentBaseOptions baseOptions, DeploymentSyncOptions syncOptions) at Microsoft.WebMatrix.Deployment.WebDeployWorker.Execute(CommandManager commandManager, CertificateValidationService certificateValidationService, Boolean skipHiddenFiles) The remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse() at Microsoft.Web.Deployment.AgentClientProvider.GetHttpResponse(HttpWebRequest request)
The solution? Just wait about an hour for Azure to update (most likely DNS) and you will be able to publish again without any issues. It’s something I can live with for today’s scenario, but if you’re considering to move a site during lunch break then this might not be the best method to guarantee everything will be up and running again in time.