When I try to publish my Azure Function I get a Publish Failed message.
I have had this message before and it has gone away after a period of time.
[Update]
I understand that Azure Functions have a cold start and expire after 5 minutes.
I find if I wait 5 minutes after getting the error then I can publish without the error. So it makes sense that the error occurs because the function app is still "live"
I have been running the function from within the Azure Portal
Am I right in this thinking ?
If so a better message would be nice.
Next time it happens I will try stopping the function from within the Portal.
Publish Failed of Azure Function MSDeploy in VS can be caused by many points, we could see more details in VS output which usually has some link directs us to Web Deploy Error Codes.
cold start is an increase in latency for functions which haven’t been called recently created on Consumption plan, deployment should have nothing to do with it.
According to your description, I guess you may meet ERROR_FILE_IN_USE
.
Web Deploy cannot modify the file 'xxx' on the destination because it is locked by an external process.
AppOffline has been achieved in Azure function, just add setting below to publish profile(funcappname - Web Deploy.pubxml
) and Azure will unlock files in use to allow deployment to work. In this way, we don't need to manually stop and start function app.
<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>
There could be other errors failing function deployment.
For ERROR_COULD_NOT_CONNECT_TO_REMOTESVC
and ERROR_DESTINATION_NOT_REACHABLE
, make sure network is fine and has no firewall/proxy restriction.
For ERROR_CONNECTION_TERMINATED
, check whether Fiddler is open.
After we eliminate possible causes on our machine, have a try at methods below.
- Have seen several related problems solved with no action taken, i.e wait for a while or retry after several days. So retry later could be a solution if we are not in a hurry.
- On portal Overview,
Reset publish credentials
then Download publish profile
. Delete old publish profiles and import the new one to publish again.
- In VS publish steps, check
Run from package file(recommended)
to avoid using MSDeploy.
- Delete all old resources relate to the function. Then create a brand new function app with new app service plan and storage. Try to publish to this new app.
- On portal
Help + support
service, New support request to get official help.