Hi @albert, although this is fine, the links still don't provide the clue to my issue.
In my scenario mentioned, I am running my code in Debug mode, but I set the environment to ASPNETCORE_ENVIRONMENT=Production
yet the check is still being performed, which according to the tickets should not be the case.
Is there possibly any update on this?
[11:05:03 ERR] ABP-LIC-0008 - License check failed for 'Volo.Abp.LanguageManagement.HttpApi-v4.4.0.0'.
You need to log in using the command `abp login <username>`.
For more information, contact to license@abp.io.
[11:05:10 INF] Initialized all ABP modules.
[11:05:10 FTL] Unable to start Kestrel.
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.BindAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerImpl.StartAsync[TContext](IHttpApplication`1 application, CancellationToken cancellationToken)
I have found this ticket: https://support.abp.io/QA/Questions/69/ but upon using the suggestion with firstly setting the value to ASPNETCORE_ENVIRONMENT I still didn't manage to make it work.
I have created within HttpApi.Host, the following code:
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
var variables = Environment.GetEnvironmentVariables();
Log.Information($"Value of environment is {variables["ASPNETCORE_ENVIRONMENT"]}");
webBuilder.UseStartup<Startup>();
})
.UseAutofac()
.UseSerilog();
Our Dockerfile looks as follows Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
# EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ./*.sln ./NuGet.Config ./
# Copy the core source project files
COPY core/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p core/${file%.*}/ && mv $file core/${file%.*}/; done
# Copy the main source project files
COPY src/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p src/${file%.*}/ && mv $file src/${file%.*}/; done
# Copy the test project files
COPY test/*/*.csproj ./
RUN for file in $(ls *.csproj); do mkdir -p test/${file%.*}/ && mv $file test/${file%.*}/; done
RUN dotnet restore "NA.OrderManagementSystem.sln" --configfile "NuGet.Config"
COPY . .
RUN dotnet build -c Release -nowarn:msb3202,msb3277,nu1503 -o /app/build --no-restore
RUN dotnet test -c Release -nowarn:msb3202,msb3277,nu1503 --no-restore --logger:trx
WORKDIR "/src/src/NA.OrderManagementSystem.HttpApi.Host"
FROM build AS publish
RUN dotnet publish "NA.OrderManagementSystem.HttpApi.Host.csproj" -c Release -o /app/publish -nowarn:msb3202,msb3277,nu1503 --no-restore
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NA.OrderManagementSystem.HttpApi.Host.dll"]
I then have run two experiments: One using the following Docker launchsettings.json
"Docker": {
"commandName": "Docker",
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"httpPort": "30321",
"useSSL": false,
"DockerfileRunArguments": "--network na.oms-network --name oms-backend -e \"ASPNETCORE_ENVIRONMENT=Production\""
}
(the dockerfile argument with Production is required to overwrite the Development default flag)
and I have also ran the following command:
docker build -f "C:\dev\ordermanagementsystem\src\aspnet-core\src\NA.OrderManagementSystem.HttpApi.Host\Dockerfile" -t "test" .
docker run -dt -e "DOTNET_USE_POLLING_FILE_WATCHER=1" -e "ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true" -e "ASPNETCORE_ENVIRONMENT=Development" -p 30322:80 --network na.oms-network --name oms-backend2 -e "ASPNETCORE_ENVIRONMENT=Production" test
Both of them produce Value of environment is Production, and the container inspection shows me that the value of the ASPNETCORE_ENVIRONMENT is indeed Production in both, yet the one from the VS crashes on license validation, but the one launched from PS runs just fine.
Things I have also tried:
However, the question still remains: If I set the ASPNETCORE_ENVIRONMENT to Production, why is the check still being performed on the VS side, but when run from the PS it also states Production and the app builds.
Could you possibly help us with this?