首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >函数主机在码头运行中没有运行错误。

函数主机在码头运行中没有运行错误。
EN

Stack Overflow用户
提问于 2019-12-27 13:50:41
回答 1查看 1.7K关注 0票数 2

我有一个功能应用程序,并计划使用Azure进行部署。当将当前函数应用程序转换为docker并在本地使用docker run command进行测试时,我会得到以下错误。

代码语言:javascript
复制
Function host is not running.

它在visual studio中调试时工作,但在Docker中不工作。其他堆栈溢出的回答建议检查host.json,我试了一下,但没有修复它。

下面是我的host.json。

代码语言:javascript
复制
{
  "version": "2.0",
  "logging": {
    "fileLoggingMode": "always",
    "logLevel": {
      "default": "Information",
      "Host": "Error",
      "Function": "Error",
      "Host.Aggregator": "Information"
    },
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "maxTelemetryItemsPerSecond": 20
      }
    }
  }
}

DockerFile

代码语言:javascript
复制
FROM microsoft/dotnet:2.2-sdk AS installer-env

COPY . /src/dotnet-function-app
RUN cd /src/dotnet-function-app && \
    mkdir -p /home/site/wwwroot && \
    dotnet publish Projects/Projectxxx.csproj --output /home/site/wwwroot

# To enable ssh & remote debugging on app service change the base image to the one below
# FROM mcr.microsoft.com/azure-functions/dotnet:2.0-appservice 
FROM mcr.microsoft.com/azure-functions/dotnet:2.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-14 10:27:10

我做了两件事让它起作用。

  • <PackageReference Include="WindowsAzure.Storage" Version="9.3.2" />添加到.csproj

  • 遗漏了一些环境变量。docker run -e环境参数中缺少一些应用程序设置,这些参数在startup.cs

中使用。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59501756

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档