【问题标题】:Publish Failed Error while publishing Azure functions on azure在 azure 上发布 Azure 函数时发布失败错误
【发布时间】:2019-03-21 13:56:54
【问题描述】:

我在 azure 门户上发布 azure 函数时出错。我尝试了很多方法并访问了很多链接,但没有找到任何合适的解决方案。

下面是输出窗口中的输出。

     Azure Application Settings updated.
1>------ Build started: Project: AwepayReconcile.DAL, Configuration: Release Any CPU ------
1>Models\AwepayContext.cs(26,10,26,214): warning CS1030: #warning: 'To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.'
1>AwepayReconcile.DAL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DAL\bin\Release\netcoreapp2.1\AwepayReconcile.DAL.dll
1>Done building project "AwepayReconcile.DAL.csproj".
2>------ Build started: Project: AwepayReconcile.DL, Configuration: Release Any CPU ------
2>Infrastructure\Extensions.cs(34,42,34,44): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(177,36,177,38): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(210,36,210,38): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(304,30,304,32): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(403,30,403,32): warning CS0168: The variable 'ex' is declared but never used
2>Services\ReconcileService.cs(40,36,40,42): warning CS0169: The field 'ReconcileService.hssfwb' is never used
2>Services\ReconcileService.cs(38,33,38,38): warning CS0169: The field 'ReconcileService.sheet' is never used
2>Services\AzureBlobStorageService.cs(29,29,29,41): warning CS0414: The field 'AzureBlobStorageService._appSettings' is assigned but its value is never used
2>AwepayReconcile.DL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DL\bin\Release\netcoreapp2.1\AwepayReconcile.DL.dll
2>Done building project "AwepayReconcile.DL.csproj".
3>------ Build started: Project: AwepayReconcile.AzureFunctionsApp, Configuration: Release Any CPU ------
3>AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\bin\Release\netcoreapp2.1\bin\AwepayReconcile.AzureFunctionsApp.dll
========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  Publish Started
  AwepayReconcile.DAL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DAL\bin\Release\netcoreapp2.1\AwepayReconcile.DAL.dll
  AwepayReconcile.DL -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.DL\bin\Release\netcoreapp2.1\AwepayReconcile.DL.dll
  AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\bin\Release\netcoreapp2.1\bin\AwepayReconcile.AzureFunctionsApp.dll
  AwepayReconcile.AzureFunctionsApp -> D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\obj\Release\netcoreapp2.1\PubTmp\Out\
  Publishing D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\obj\Release\netcoreapp2.1\PubTmp\AwepayReconcile.AzureFunctionsApp - 20190320182641787.zip to https://awepayreconcileazurefunctionsapp20190320061400.scm.azurewebsites.net/api/zipdeploy...
C:\Users\tejinder.s\.nuget\packages\microsoft.net.sdk.functions\1.0.26\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.ZipDeploy.targets(42,5): error : The attempt to publish the ZIP file through https://awepayreconcileazurefunctionsapp20190320061400.scm.azurewebsites.net/api/zipdeploy failed with HTTP status code RequestTimeout. [D:\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp\AwepayReconcile.AzureFunctionsApp.csproj]

请帮我摆脱这个。

谢谢

【问题讨论】:

  • 您是否尝试按照错误提示将Newtonsoft.Json 的版本更改为11.0.2?
  • @GregH,是的,我已经更改了Newtonsoft.json 的版本。但它不起作用。我在更改Newtonsoft.json 版本后更新了上面的输出。请检查。
  • 在发布之前需要检查您的 azure 服务是否正在运行、计算机上的防火墙设置、关闭计算机上的 fiddler(或任何设置反向代理的应用程序)
  • 另外,看看这个线程:stackoverflow.com/questions/53103896/…

标签: azure asp.net-core azure-functions


【解决方案1】:

将函数应用部署到 Windows 时,应将 WEBSITE_RUN_FROM_PACKAGE 设置为 1 并使用 zip 部署发布。

Zip deployment 是 Azure 应用服务的一项功能,可让您将函数应用项目部署到 wwwroot 目录。该项目打包为 .zip 部署文件。可以使用相同的 API 将您的包部署到 d:\home\data\SitePackages 文件夹。

使用 WEBSITE_RUN_FROM_PACKAGE 应用程序设置值 1,zip 部署 API 将您的包复制到 d:\home\data\SitePackages 文件夹,而不是将文件解压缩到 d:\home\site\wwwroot。它还会创建packagename.txt 文件。重新启动后,函数应用会从包中运行,wwwroot 变为只读。

更多详情可以参考这个article

【讨论】:

  • 你能说得更清楚一点吗?当我尝试从 Visual Studio 发布代码时。我需要为我的项目创建一个 Zip 吗?我有点困惑。
  • 不,你只需要在门户上的天蓝色功能,并在application settings中添加WEBSITE_RUN_FROM_PACKAGE1
  • 我在应用程序设置中检查了WEBSITE_RUN_FROM_PACKAGE已经设置为1
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-02
  • 1970-01-01
  • 1970-01-01
  • 2022-08-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多