Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Azure函数Kubernetes找不到local.settings.json_C#_Docker_Kubernetes_Azure Functions_Keda - Fatal编程技术网

C# Azure函数Kubernetes找不到local.settings.json

C# Azure函数Kubernetes找不到local.settings.json,c#,docker,kubernetes,azure-functions,keda,C#,Docker,Kubernetes,Azure Functions,Keda,我正在尝试将我的Azure功能应用程序发布到Kubernetes,但运行此命令时出现以下错误 func kubernetes deploy--命名我的函数api--命名空间默认--注册表mycontainerregistry/docker azure函数--csharp 找不到项目根目录。希望在项目根目录中找到host.json、local.settings.json之一` 这是我的docker文件 FROM mcr.microsoft.com/dotnet/sdk:3.1 AS install

我正在尝试将我的Azure功能应用程序发布到Kubernetes,但运行此命令时出现以下错误

func kubernetes deploy--命名我的函数api--命名空间默认--注册表mycontainerregistry/docker azure函数--csharp

找不到项目根目录。希望在项目根目录中找到host.json、local.settings.json之一`

这是我的docker文件

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS installer-env

COPY . .
RUN cd /MyFunctionApp.Api && \
    mkdir -p /home/site/wwwroot && \
    dotnet publish *.csproj --output /home/site/wwwroot

COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /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:3.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
如您所见,我尝试添加以下行

COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /home/site/wwwroot
但这似乎也没有帮助,所以我不确定我需要做什么才能让它工作?
如果有任何帮助,我们将不胜感激。

好的,所以我想好了。Azure函数在容器中运行时不读取
local.settings.json
settings.json
。这些键需要设置为环境变量

您需要将
local.settings.json
放在运行
func kubernetes deploy
命令的同一文件夹中,该文件夹将生成一个yaml文件,其中包含启动时传递到容器中的设置

注意:这似乎不适用于设置
CORS
设置。我有一个新问题要问