简体   繁体   English

如何修复错误发布到 azure function

[英]How to fix error publishing to azure function

I have a functionapp that I made in visual studio 2019. I want to publish this app to an azure function that already exists in Azure.我有一个在 Visual Studio 2019 中制作的功能应用程序。我想将此应用程序发布到 azure function 中,该 Z3A580F142203677F1F0BC30898F63F5Z3 中已经存在。 But when I try to publish from VS I get the following error:但是当我尝试从 VS 发布时,出现以下错误:

在此处输入图像描述

I tried to update VS to the latest version and updating the Microsoft.NET.Sdk.Functions packet to version 1.0.35 since the following versions require.NetCore 3 and I use.NetCore 2.1.我尝试将 VS 更新到最新版本并将 Microsoft.NET.Sdk.Functions 数据包更新到版本 1.0.35,因为以下版本需要.NetCore 3,而我使用.NetCore 2.1。 I also tried to do a Webdeploy but got the same error.我也尝试做一个 Webdeploy 但得到了同样的错误。

When I changed my.NetCore version to 3.1 and do a WebDeploy I now get this error:当我将 my.NetCore 版本更改为 3.1 并执行 WebDeploy 时,我现在收到此错误: 在此处输入图像描述

I looked this up and people said to change the WEBSITE_RUN_FROM_PACKAGE value to 0, I tried this and even tried deleting this and it still gave the same error.我查了一下,人们说将 WEBSITE_RUN_FROM_PACKAGE 值更改为 0,我尝试了这个,甚至尝试删除它,它仍然给出了同样的错误。

I also tried ZIP-deploy and then I get this error:我也试过 ZIP-deploy 然后我得到这个错误: 在此处输入图像描述

I also edited the runtimesettings when I changed the version.更改版本时,我还编辑了运行时设置。

My project structure:我的项目结构: 在此处输入图像描述

In the map IntentFunctions are 6 other azure functions.在 map IntentFunctions 中有 6 个其他 azure 函数。

Even creating a new app service from VS and then publishing doesn't work.即使从 VS 创建一个新的应用服务然后发布也不起作用。

I saw that most other azure function apps have a json file for each function and I do not have this only a host.json file, might this be the problem? I saw that most other azure function apps have a json file for each function and I do not have this only a host.json file, might this be the problem?

Anyone know a fix?有人知道修复吗? Thanks in advance提前致谢

It seems like Azure Functions default to use.Net Core 3. If you want to change the version, according to this link: https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions , you should be able to change the FUNCTIONS_EXTENSION_VERSION application setting to ~2.好像 Azure 函数默认使用.Net Core 3。如果要更改版本,请根据此链接: https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions ,您应该能够将 FUNCTIONS_EXTENSION_VERSION 应用程序设置更改为 ~2。 Also you can set the AzureFunctionsVersion in your.csproj like so: <AzureFunctionsVersion> v2 </AzureFunctionsVersion>您也可以在 your.csproj 中设置 AzureFunctionsVersion,如下所示: <AzureFunctionsVersion> v2 </AzureFunctionsVersion>

I do not think your problem is the version of the Function.我不认为你的问题是 Function 的版本。 Framework version would be the problem if the application was deployed successfully but could not start.如果应用程序部署成功但无法启动,框架版本将成为问题。 Your problem is that the ZIP package can not make it to the server, according to the logs.根据日志,您的问题是 ZIP package 无法进入服务器。

I had a similar problem before when deploying from VS from home, the problem was slow home internet connection.在从家里部署 VS 之前,我遇到过类似的问题,问题是家庭互联网连接速度慢。

Here is the link that helped me: Publish to Azur fails with 500 internal Server Error这是帮助我的链接: Publish to Azur failed with 500 internal Server Error

Updated Answer更新的答案

I generally distrust visual studio because it is doing a lot of stuff under the hoods and caches a lot of data to boost performance.我通常不信任visual studio,因为它在幕后做了很多事情并缓存了大量数据以提高性能。 You can instead try to use another mean of publishing as explained by Microsoft here https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push , like a rest call or azure cli. You can instead try to use another mean of publishing as explained by Microsoft here https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push , like a rest call or azure cli.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM