【发布时间】:2019-12-27 13:50:41
【问题描述】:
我有一个函数应用,并计划使用 Azure KEDA 进行部署。将当前函数应用程序转换为 docker 并使用 docker run command 在本地进行测试时,出现以下错误。
Function host is not running.
它在 Visual Studio 中调试时有效,但在 Docker 中无效。其他stackoverflow答案建议检查host.json,我试过了,但没有修复。
下面是我的 host.json。
{
"version": "2.0",
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Information",
"Host": "Error",
"Function": "Error",
"Host.Aggregator": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"maxTelemetryItemsPerSecond": 20
}
}
}
}
Docker 文件
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"]
【问题讨论】:
-
这能回答你的问题吗? Function host is not running
-
不,已经看过了。
-
Related 没有回答你的问题;你能告诉我们你尝试了什么,这样我们就不会浪费任何人的时间了吗?您的帖子缺少这些详细信息,并且会很有帮助...另一方面,主机日志文件呢,它们告诉您什么?
-
它在 docker 中,所以我看不到日志文件。我已经尝试了您建议的答案中发布的所有步骤。
-
可能也值得发布您的 Docker 文件?
标签: c# azure docker azure-functions serverless