0
votes

I created an Azure function tonight in Visual Studio and had errors publishing it. So I created a vanilla HTTP triggered one, and tried to publish it, no code changes. Same errors. I am logged in to my Azure account, I've downloaded a publish profile, and reset it and tried again. I've done it by selecting the function app in the IDE. I've tried figuring out how to FTP the function app, but I pushed files up and nothing appeared in the portal (I copied the build folder into the wwwroot folder on the server). In FTP, I can see in the deployment folder some files are there, that denote that an attempted deployment failed, so it's talking to Azure, and deciding it hasn't worked.

The error log is not very helpful:

30/05/2019 8:46:11 PM System.AggregateException: One or more errors occurred. ---> System.Exception: Publishing failed. --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.Publish.Framework.Model.DefaultPublishSteps.<>c__DisplayClass26_0.b__2() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Publish.Framework.Model.DefaultPublishSteps.d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.d__176.MoveNext() ---> (Inner Exception #0) System.Exception: Publishing failed.<---

===================

I'd be quite happy to do it via FTP if there was a guide on what to put where.

2
ensure that you do not have zip deploy enabled by going into the portal and checking your app settings, i think there's a setting something like zip_deploy or somethign like that, remove it! - Alex Gordon
Thanks - I tried zip and FTP deploy. It all started working when I added all the settings that were in a downloaded solution and not in the one I created with VS - cgraus

2 Answers

0
votes

I'm not sure about the Visual Studio issue. I ran into something similar once, and it required me to log out of my Azure subscription and log back in before it got resolved. You may want to give that a try if you haven't already.

Regarding alternate deployment strategies, I suggest you take a look at the Run from Package deployment feature. It allows you to publish your app as a zip file and run it that way. Other MS-specific tools (VS Code, Azure Pipelines, etc.) are moving towards using this mechanism rather than the legacy "MSDeploy" mechanism that Visual Studio uses today.

0
votes

So, I found the issue. If you create a function inside Azure and download it, it will use csx files, which is not what I wanted, but, the local.settings.json contains a ton of settings that are not in the VS generated file. Copying those into my project made it all work. You should use your own download, so the settings are correct for you, but, it was settings like this:

"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"WEBSITE_SLOT_NAME": "Production",
"FUNCTIONS_EXTENSION_VERSION": "~2",
"ScmType": "None",
"WEBSITE_AUTH_ENABLED": "False",
"APPINSIGHTS_INSTRUMENTATIONKEY": "xxxxxx",
"WEBSITE_NODE_DEFAULT_VERSION": "10.14.1",
"WEBSITE_CONTENTAZUREFILECONNECTIONSTRING": "DefaultEndpointsProtocol=xsxxxxxx",
"WEBSITE_CONTENTSHARE": "xxxx",
"WEBSITE_SITE_NAME": "xxxxxx",
"AzureWebJobsStorage": "DefaultEndpointsProtocol=xxxxxxxx"

Deploying also caused my project to download missing DLLs, so it seems the wizard in Visual Studio is a complete wash.