Azure Functions Kubernetes cannot find local.settings.json - c#

I am trying to publish my Azure Functions App to Kubernetes but I am getting the following error when I run this command
func kubernetes deploy --name my-function-api --namespace default --registry mycontainerregistry/docker-azure-function --csharp
Unable to find project root. Expecting to find one of host.json, local.settings.json in project root.`
This is my docker file
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"]
As you can see I have tried adding the following lines
COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /home/site/wwwroot
But that does not seem to help either, so not sure what I need to do to get this working?
Any help would be appreciated.

Ok so figured this out. Azure Functions does not read local.settings.json or settings.json when running in a container. These keys need to be set as environment variables.
You need to have the local.settings.json in the the same folder that you run the func kubernetes deploy command from and that will generate a yaml file with the settings that get passed into the container when it is started.
NB: this does not seem to work with setting CORS settings. I have a new question for that here CORS Issue with Azure Functions inside AKS Cluster

Related

empty response - Docker Container ASP.NET CORE 6

I got stuck on this for quite some time and i don't know why it doesn't work.
I looked into posts similair to mine but i can't fix it, (tried checking the firewall settings, using different ports).
I have a Dockerfile that looks like this:
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
COPY bin/Release/net6.0/publish/ App/
WORKDIR /App
ENTRYPOINT ["dotnet", "MonitorApplication1.dll"]
The application is a simple REST API with C# .NET Core 6. The database is a MS SQL Server Database.
The image and container seem fine but when i try to view it in the browser (using Chrome as standard, but also tried Edge) i get the ERR_EMPTY_RESPONSE error.
The log of the container (using Docker Desktop) only shows this:
{"EventId":14,"LogLevel":"Information","Category":"Microsoft.Hosting.Lifetime","Message":"Now listening on: http://[::]:80","State":{"Message":"Now listening on: http://[::]:80","address":"http://[::]:80","{OriginalFormat}":"Now listening on: {address}"}}
Update
I tried to create a new .NET 6 API with Docker Enabled but when i tried to run the container i still get the Error Empty Response.
I solved a similar problem by adding the ASPNETCORE_URLS environment variable, like this:
ENV ASPNETCORE_URLS=http://*:5000

Unable to get the local directory referenced to docker

I have a console application published in linux, the application reads the data from a particular directory in Linux. so if I want to run the console application, I would do the below
./myapp "/home/user1/mydata"
Files in mydata directory will be changing. It all works fine when I run the application directly in the Linux terminal.
But when I dockerize the application, I am unable to read the directory "/home/user1/mydata".
Below is Dockerfile contents
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
COPY . .
ENTRYPOINT ["./myapp"]
my intention is when I run the docker image, I will also the include path of the directory
for example
docker run myimage:latest "/home/user1/mydata"
I understand that in order to read the directory, I need first mount the directory, so I created a volume
docker volume create myvolume
and then mounted my target directory
docker run -t -d -v my-vol:/home/user1/mydata --name mycontainer myimage:latest
even after mounting when I am running the docker as
docker run myimage:latest "/home/user1/mydata"
It is still unable to read the directory. Am I doing something wrong here ? After mounting the directory do I have to change the way I call my argument in this case /home/user1/mydata ?
docker volume create myvolume will create a folder in docker system location, while -v my-vol:/home/user1/mydata will pop the /home/user1/mydata in container to that docker host's system location, typically /var/lib/docker/volumes.
So, for your case, you need to use bind mount, not volume, something like next:
docker run -t -d -v /home/user1/mydata:/home/user1/mydata --name mycontainer myimage:latest "/home/user1/mydata"
-v /home/user1/mydata:/home/user1/mydata will mount the folder /home/user1/mydata on docker host to container's /home/user1/mydata, so this I guess could meet your requirement.

web api does not start up with NetCore 3 web api in linux container on azure

I am trying to "dockerize" this clean architecture template for .net Core 3. I use the docker pull request here as the base for my proff of concept app. This is a .net core 3 webapi project with an Angular front end as the client app.
WHAT I HAVE:
The base code from the pull request works locally.
An initial problem I had to overcome was setting the cert for identity server 4 in a local non development env, I had to mount a volume with the cert and reference it from the appsettings.json file like
"IdentityServer": {
"Key": {
"Type": "File",
"FilePath": "/security/mycert.pfx",
"Password": "MyPassword"
}
}
I set up a CI/CD pipeline in azure to build the project and deploy the image to an azure container registry
I set up a CI/CD release to deploy the docker image to a Web App for Containers (Linux) web app. Both these steps work properly
MY PROBLEM:
The web app loads and runs the container and the angular front end is shown. However, it appears that the web api is not running. Any attempt to hit an endpoint of the web api returns the following error in the browser console:
GET https://.....azurewebsites.net/_configuration/CleanArchitecture.WebUI 404 (Not Found)
Error: Uncaught (in promise): Error: Could not load settings for 'CleanArchitecture.WebUI' Error: Could not load settings for 'CleanArchitecture.WebUI'
CleanArchitecture.WebUI is the name of the assembly that is the entry point in the dockerfile:
ENTRYPOINT ["dotnet", "CleanArchitecture.WebUI.dll"]
All other aspects of the front end work properly, only calls to "backend" api fail.
Another issue is that if I get the docker logs from the azure container, there are no errors shown.
WHAT I TRIED
I tried to add "dotnet CleanArchitecture.WebUI.dll" to the startup command of the container in the container settings of the web app, but that just throws an error that it can't find CleanArchitecture.WebUI.dll
I have tried to increase the logging level ("LogLevel": "Default": "Debug") to get more details, but no additional error details are shown in the docker logs.
It might be an error loading the Identity Server 4 certificate, but there are no errors to confirm this problem.
Here is my docker compose file that is used by the azure pipeline:
version: '3.4'
services:
webui:
image: ${DOCKER_REGISTRY-}webui
build:
context: .
dockerfile: src/WebUI/Dockerfile
environment:
- "UseInMemoryDatabase=false"
- "ASPNETCORE_ENVIRONMENT=Production"
- "ConnectionStrings__DefaultConnection=myconnection"
- "ASPNETCORE_Kestrel__Certificates__Default__Password=mypass"
- "ASPNETCORE_Kestrel__Certificates__Default__Path=/security/mycert.pfx"
ports:
- "5000:5000"
- "5001:5001"
volumes:
- mcpdata:"/security:/"
restart: always
mcpdata is the name of the azure file share that gets mounted and contains the actual cert
here is my azure-pipeline.yml for the CI/CD:
trigger:
- staging
resources:
- repo: self
variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: '****'
imageRepository: 'cleanarchitecture'
containerRegistry: '****.azurecr.io'
dockerComposeFilePath: '$(Build.SourcesDirectory)docker-compose.Production.yml'
tag: '$(Build.BuildId)'
# Agent VM image name
vmImageName: 'ubuntu-latest'
stages:
- stage: Build
displayName: Build and push stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
- task: Docker#2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerComposeFile: $(dockerComposeFilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: staging
QUESTION?
Can someone help me figure out why it appears like my web api is not running but no errors are thrown. At a minimum I would be happy if someone could help me see the errors in the docker logs.
thanks in advance
I tried to repeat, with "clean architecture" using the following (note, I'm using zsh on MacOS, but the same should work on Windows/Linux too):
take clean_architecture
dotnet new --install Clean.Architecture.Solution.Template
dotnet new ca-sln
The documentation suggests, clicking F5 in Visual Studio will start the template, although I had to do:
cd src/WebUI/ClientApp
npm install
At this point the app starts locally by hitting F5. Note, what happens here is that ASP.Net Core forwards requests to the dev server, so effectively, this does ng serve --port 53543 AND starts Asp.Net Core (Kestrel in my case) on port 5001, browsing to http://127.0.0.1:53543 provides the angular page directly. Browsing to https://localhost:5001 brings up the same angular page, as forwarded by ASPNetCore to Angular. All very confusing... Detailed more here
Note in Startup.cs the following lines of code exist, these are usually set based on the environment variable ASPNETCORE_ENVIRONMENT
if (!env.IsDevelopment())
{
app.UseSpaStaticFiles();
}
-- and within "app.UseSpa"
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "start");
}
Anyway, it looks like you've got that environment variable set to Production, which should just serve the built files from the ClientApp\dist folder (rather than forwarding to the dev server) that suggests that if you see the Angular, then the .Net Core service is running... I'll try and rebuild the Dockerfiles first...
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
ENV ASPNETCORE_URLS=https://+:5001;http://+:5000
WORKDIR /app
EXPOSE 5000
EXPOSE 5001
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt install -y nodejs
WORKDIR /src
COPY ./src/WebUI/WebUI.csproj src/WebUI/
COPY ./src/Application/Application.csproj src/Application/
COPY ./src/Domain/Domain.csproj src/Domain/
COPY ./src/Infrastructure/Infrastructure.csproj src/Infrastructure/
RUN dotnet restore "src/WebUI/WebUI.csproj"
COPY . .
WORKDIR "/src/src/WebUI"
RUN dotnet build "WebUI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebUI.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "CleanArchitecture.WebUI.dll"]
Then build and run as follows:
# build takes a while
docker build -f ./src/WebUI/Dockerfile -t clean-architecture .
# note, this fails first time, because I set up as clean_architecture so the entry point is incorrect
docker run --rm -it -p 5000:5000 -p 5001:5001 clean-architecture
# run the container and override the entrypoint
docker run --rm -it --entrypoint /bin/bash clean-architecture
# From within the container...
root#93afb0ad21c5:/app# dotnet clean_architecture.WebUI.dll
# note, in .Net 3.1, you can also do this directly, as follows:
root#93afb0ad21c5:/app# ./clean_architecture.WebUI
Now there is a problem with LocalDB: System.PlatformNotSupportedException: LocalDB is not supported on this platform.
Switch appsettings.Production.json to be "UseInMemoryDatabase": true
The problem then appears to be certificates...
I created a certificate using:
dotnet dev-certs https -ep ./https/clean-arch.pfx -p anything
For IdentityServer, I change appSettings.Production.json as follows:
"IdentityServer": {
"Key": {
"Type": "File",
"FilePath": "/app/https/https/clean-arch.pfx",
"Password": "anything"
}
}
and then running on Linux, probably means running Kestrel, which means we need to provide HTTPS certs there too, which I did by setting the following in Program.cs
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel((context, options) =>
{
options.AllowSynchronousIO = true;
options.Listen(IPAddress.Loopback, 5000, listenOptions =>
{
listenOptions.UseConnectionLogging();
listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http1AndHttp2;
});
options.Listen(IPAddress.Any, 5001, listenOptions =>
{
listenOptions.UseConnectionLogging();
listenOptions.Protocols = Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols.Http1AndHttp2;
listenOptions.UseHttps(new System.Security.Cryptography.X509Certificates.X509Certificate2("/app/https/https/clean-arch.pfx", "anything"));
});
});
webBuilder.UseStartup<Startup>();
});
At each stage I built the app in docker using...
\clean_architecture $ docker build -f ./src/WebUI/Dockerfile -t clean-architecture .
/clean_architecture $ docker run --rm -it -v /Users/monkey/src/csharp/clean_architecture/:/app/https/ -p 5000:5000 -p 5001:5001 --entrypoint /bin/bash clean-architecture
... and once running in bash (in docker), I used the following to start the application:
root#c5b4010d03be:/app# ./clean_architecture.WebUI
Good luck, hope that helps. Note, if it works in Docker, on your machine, it should work in Azure. I'll look at getting it going in Azure another day. Happy to upload my code to GitHub if it would help?
thanks to 0909EM for the huge effort in answering the question, but the solution was different.
I figured out what was going on. There are two issues.
The docer-compose.override.yml file looks like:
version: '3.4'
services:
webui:
environment:
- "ASPNETCORE_ENVIRONMENT=Development"
- "SpaBaseUrl=http://clientapp:4200"
clientapp:
image: ${DOCKER_REGISTRY-}clientapp
build:
context: src/WebUI/ClientApp
dockerfile: Dockerfile
depends_on:
- webui
restart: on-failure
db:
ports:
- "1433:1433"
notice the line dockerfile: Dockerfile in the src/webui/clientapp context. This dockerfile was overwriting the proper docker file in src/webui during the azure pipeline build. For some reason when I run the following command locally: docker-compose -f 'docker-compose.Production.yml' up --build it does not pull in the docker-compose.override settings, but the override settings do get used in the azure pipeline build.
Therefore, the angular dockerfile is the only one built and that image does not contain the .net core web api project. Which explains why I see the front end but cannot get to the api endpoints and also why the dockerfile has no .net core errors.
I was able to fix this in two ways.
First: rename the dockerfile in src/webui/clientapp to Dockerfile.clientapp and change the line in the docker.overrride file to dockerfile: Dockerfile.clientapp
SECOND: just remove the docker override file from the online repository that the azure pipeline pulls from.
As a result the proper dockerfile is used and the web api project is in the image.
The second issue: Now that the proper image is running, the .net core web api throws an error about loading the cert for identity server. This confirms my suspicion. Because this issue is not related to my original question about getting the web api running in the container, i have opened another question about it.

dotnet publish fails during docker build

First of all, I am sorry if I misinterpret what I get, I'm completly new to Docker.
So I'm developping a software to process csv files into a database, and everything runs in GCP. To run my code, I have access to a Cloud Run that can use Docker images.
Today I added 3 new files :
'BusinessLogic/Repository/AcademyRepository.cs'
'BusinessLogic/Repository/Interfaces/ISourceRepository.cs'
'BusinessLogic/Repository/SourceRepository.cs'
Prior to these modifications, I had to run 3 commands to publish my code on the cloud run :
dotnet build
gcloud builds submit --tag gcr.io/myproject/mytag
gcloud run deploy myservice gcr.io/myproject/mytag--platform managed
But since I added these files, I get the following error :
/usr/share/dotnet/sdk/3.1.401/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets(295,5): error NETSDK1022: Duplicate 'Compile' items were included. The .NET SDK includes 'Compile' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'BusinessLogic/Repository/AcademyRepository.cs'; 'BusinessLogic/Repository/Interfaces/ISourceRepository.cs'; 'BusinessLogic/Repository/SourceRepository.cs' [/app/MyProject.csproj]
I saw on multiple threads to check .csproj files for weird ... entries but there was nothing like this in mine.
And here is my dockerfile :
# Use Microsoft's official build .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-sdk/
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
# Install production dependencies.
# Copy csproj and restore as distinct layers.
COPY *.csproj ./
RUN dotnet restore
# Copy local code to the container image.
COPY . ./
WORKDIR /app
# Build a release artifact.
RUN dotnet publish -c Release -o out # This step fails
# Use Microsoft's official runtime .NET image.
# https://hub.docker.com/_/microsoft-dotnet-core-aspnet/
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine AS runtime
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories && apk update --no-cache && apk add --no-cache bash libc6-compat=1.1.19-r11
WORKDIR /app
COPY --from=build /app/out ./
# Run the web service on container startup.
ENTRYPOINT ["dotnet", "MyDll.dll"]
I tried running the command that fails outside of the gcloud builds submit command but nothing wrong happened
If I delete the files and comment the related code, the problem vanishes ... but I kinda need those files
EDIT :
Editing a csproj file from visual studio doesn't show you the actual file, it shows you a modified version. I edited the csproj with notepad, cleaned then recompiled the project but the problem is still here.
Found a workaround :
Here is a part of my architecture :
BusinessLogic
--- Repositories
--- Interface
The problem resides in the "Interface" folder. By deleting it and adding my interfaces in the parent folder (Repositories), the problem disappears. Still no idea how to solve the real problem though

appSettings.json for .NET Core app in Docker?

I am running a .net core app in a docker container. Here is my docker file (just to build a dev environment):
FROM microsoft/dotnet:1.0.1-sdk-projectjson
ENV ASPNET_ENV Development
COPY bin/Debug/netcoreapp1.0/publish/ /root/
EXPOSE 5000/tcp
ENTRYPOINT dotnet /root/AVP.WebApi.dll
I have an appSettings.Development.json file in the /publish/ folder. If I build and run this Docker file, I end up with a strange issue where the .NET app can't find the appsettings it needs to start (they're in the appSettings.Development.json file).
I have confirmed that from the command line in windows if I run dotnet publish/AVP.WebAPI.dll the app throws the same exceptions for missing configuration settings. However if I cd to /publish and run dotnet AVP.WebAPI.dll the app starts and runs just fine.
Any ideas how to change my docker file so it will run the app properly with the appSettings.Development.json values? (I've also tried to run the app with all the values copied into the regular appSettings.json files with no luck)
I've also tried running a the COPY command to / instead of /root and doing dotnet AVP.WebApi.dll as the entry point, but that results in the project being unable to find dependencies.
Try replacing this line:
ENV ASPNET_ENV Development
With this:
ENV ASPNETCORE_ENVIRONMENT Development
Your original Environment Variable name was used in older .NET Core, but has been changed. It can be a pain finding tutorials, etc. for .NET Core because of all of the changes that have happened since it first started!
Don't get me started on project.json files!
More info:
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments
As a follow up to everyone (I posted this is a comment originally), this is what ended up fixing it:
From what I can tell it looks like dotnet expects the appsettings files to be in the same directory it is run from. So I added COPY bin/Debug/netcoreapp1.0/publish/appsettings.json /appsettings.json to the dockerfile (this line copies the appsettings file to the directory below /root/ where I copied the publish folder to). Everything started working at this point. It appears that the dotnet executable runs from the directory below /root/ so it couldn't find it before, now that appsettings is in the same folder, it's all happy.
It late, but i think my solution will help other.
Step 1. Put appseting in folder "Settings/appsettings.json".
Here is my appsettings.json
{
"ConnectionString": "Data Source=local;Initial Catalog=mydb;User Id=username;Password=myStr0ngPassword#;"
}
Step 2. Edit code from asp netcore.
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
namespace Repos.Configs
{
public static class ConfigurationManager
{
public static string currentPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
public static IConfiguration AppSetting { get; }
static ConfigurationManager()
{
AppSetting = new ConfigurationBuilder()
.SetBasePath(currentPath)
.AddJsonFile("Settings/appsettings.json") // your path here
.Build();
}
}
}
And use AppSetting.
var connectionString = ConfigurationManager.AppSetting["ConnectionString"];
Step 3. now u must config your dockerfile, in my case, create by visual studio in linux container.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
WORKDIR /src
COPY ["Api/Api.csproj", "Api/"]
COPY ["Repos/Repos.csproj", "Repos/"]
COPY ["DataContext/DataContext.csproj", "DataContext/"]
RUN dotnet restore "Api/Api.csproj"
COPY . .
WORKDIR "/src/Api"
RUN dotnet build "Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Api.dll"]
Step 4. Build image.
docker build -t tagForProject .
Step 5. Map volume and run your container from image.
docker run -p 44382:80 --volume c:\Docker\Volumes\MyProjectNetCore:/app/Settings --name nameWillDisplayInDockerDashboard -d tagForProject
OK, one problem here, because docker will override c:\Docker\Volumes\MyProjectNetCore to /app/Settings. So, you must put appseting.json to c:\Docker\Volumes\MyProjectNetCore.
If not, your app cant read appsetting because it not exist in docker volume.
Step 6. Restart your app in docker dashboard and see it work.
There are three problems i can think of why it can't find the appsettings:
They are not in the right folder in the container (did you copy the publish folder and does the publish folder contain the appsetting
You did not define using appsettings for the environment in the StartupClass: appSettings.${Environment}.json
It works locally because windows filesystem is case-insensitive and linux is case sensitive and thus it can't find the file. (check your capitalization).
I use docker-compose with .net 5, I put this on my yaml :
container_name: heroapi
environment:
- ASPNETCORE_ENVIRONMENT=alpha
for use appsettings.alpha.json file and it's work
Just came across this issue myself and the problem was the file is not being copied by default.
This was fixed by editing the .csproj file and adding :
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
This can also be done through UI by right clicking the appsettings file within visual studio, selecting properties and setting sopy to directory to "Always".
My problem was, through all this docker container stuff.. I never built the project in Release Mode, so the appsettings.json file in /bin/release/publish was very old.
I just hit this issue myself, and Sam's answer did solve it. Just to propose a different solution, you can also set the WORKDIR /root directive in the Dockerfile and then use ENTRYPOINT dotnet AVP.WebApi.dll which will call dotnet in the context of the root directory.
Full Dockerfile:
FROM microsoft/dotnet:1.0.1-sdk-projectjson
ENV ASPNET_ENV Development
COPY bin/Debug/netcoreapp1.0/publish/ /root/
WORKDIR /root
EXPOSE 5000/tcp
ENTRYPOINT dotnet AVP.WebApi.dll
for compose:
environment:
- ASPNETCORE_ENVIRONMENT=Production
For Docker:
ENV ASPNETCORE_ENVIRONMENT: "Production"
there is a quick and easy way to Update/edit the AppSettings.json file:
for example my AppSettings.json file :
{
"GrpcOption": {
"ServerAddress": "oldurl"
},
}
now i can modify it by -e command
docker run -e "GrpcOption:ServerAddress=newurl" [imagename]

Categories