backtrack5r3
❔ Exception while using .BindConfiguration instead of .Configure
Hello !
I need some help to understand why I get an while I am using Option Pattern (https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options?view=aspnetcore-7.0) with dependency injection.
The exception :
My tests are using a custom helper which iterate through a IServiceCollection to retrieve service from default IoC by using IServiceProvider.GetService( ServiceDescriptor.ServiceType).
At the beginning I was registering my options this way (which cause the exception spoken above) :
I changed the registration for this way (which work perfect) :
The difference on the code from .BindConfiguration and .Configure :
- .BindConfiguration use this instruction:
-.Configure use this instructio :
Can someone explain the difference and why the first one throw an exception please ?
Thank you
4 replies
❔ Get Console App args inside Docker container with Docker-compose
Hi,
I have trouble with a .NET6 Console App and Docker with the use of args.
If I launch the Console App without Docker in VS22 everything is okay, my args are retrieved, but when I use with Docker container inside a Docker-compose nothing happen...
I tried to edit the Dockerfile to hardcode the value of the args, use the "command" part of docker-compose but nothing is working.
Someone have a solution ? I would like to not use env variable to handle args.
Thank you,
Tom.
45 replies