Replies: 1 comment 1 reply
-
The builder.WebHost.ConfigureAppConfiguration (fun hostingContext config ->
if hostingContext.HostingEnvironment.IsEnvironment "YourEnv" then
do config.AddUserSecrets(Assembly.GetExecutingAssembly())
) or builder.WebHost.ConfigureAppConfiguration (fun hostingContext config ->
if hostingContext.HostingEnvironment.IsEnvironment "YourEnv" then
do config.AddUserSecrets "YourUserSecretsId"
) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
So I'm trying to create a .net 8 web application using F#.
Pretty simple one, but I've noticed an issue when I change the ASPNETCORE_ENVIRONMENT. Seems that if the value of that environment variable is not "Development" the "AddUserSecrets" is not called so it throws me an exception because the Kestrel Certificate from the secrets.json is not being loaded:
System.InvalidOperationException: 'Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.
(running the suggested dev-certs commands didn't help)
https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-8.0
I've found a github issue related to it with a "solution"
dotnet/AspNetCore.Docs#19359
But I'm using F# and top-level statements with an unique Program.fs and I don't find the way of adapting this to my solution:
`
#nowarn "20"
`
I've tried to do something like
builder.Configuration.AddUserSecrets<Program>() |> ignore
but it's not recognized as Configuration is only a getter.Beta Was this translation helpful? Give feedback.
All reactions