Closed Rhywden closed 11 months ago
Thanks for contacting us. This is most probably due to the fact that the environment you run your app does not match the appsettings.*.json file matching that environment. Hopefully this documentation will help you get started with this correctly: https://learn.microsoft.com/aspnet/core/fundamentals/environments?view=aspnetcore-8.0
Note, that this has nothing to do with the build configuration (debug or release).
Yeah, that would make sense if I had already customized the default project. And the default, as far as I can remember, is to "build in development".
But I did not. But here's some more proof:
You can see that the bool isDevelopment
is true
but that the clientId
is set to FooProd
when it clearly should be FooDev
.
@mkArtakMSFT Oh, I just noticed that you can also see this by the fact that the ConnectionString
is only set on appsettings.json
but not in appsettings.Development.json
which would actually make the default project (i.e. the one you get right after clicking "Create" in the project template dialog) crash and burn.
Due to the lovely "Throw exception if ConnectionString
is not set" guard clause in line 39 in my screenshot.
@mkArtakMSFT @martincostello Uh, guys, this is very much neither answered nor resolved.
Is there an existing issue for this?
Describe the bug
Created a new Blazor Web App. Configured it so that OIDC settings reside in appsettings.json / appsettings.Development.json. Both files exist per default on a newly created project. I then bound those settings to the OIDC service like thus:
Program.cs
appsettings.json
appsettings.Development.json
No other changes were made. I then started the app in Debug inside Visual Studio.
Expected Behavior
I expected to land at
https://localhost:7162/signin-oidc
after a succesful auth. Instead I landed athttps://foo/signin-oidc
, i.e. the address for the production site.Steps To Reproduce
Exceptions (if any)
No response
.NET Version
8.0.100
Anything else?
Visual Studio Enterprise 2022 17.8.1
.NET SDK: Version: 8.0.100 Commit: 57efcf1350 Workload version: 8.0.100-manifests.71b9f198
Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.100\
.NET workloads installed: Workload version: 8.0.100-manifests.71b9f198 [android] Installation Source: VS 17.9.34310.174, VS 17.8.34316.72 Manifest Version: 34.0.43/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.43\WorkloadManifest.json Install Type: Msi
[maui-windows] Installation Source: VS 17.9.34310.174, VS 17.8.34316.72 Manifest Version: 8.0.3/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.3\WorkloadManifest.json Install Type: Msi
[maccatalyst] Installation Source: VS 17.9.34310.174, VS 17.8.34316.72 Manifest Version: 17.0.8478/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.0.8478\WorkloadManifest.json Install Type: Msi
[ios] Installation Source: VS 17.9.34310.174, VS 17.8.34316.72 Manifest Version: 17.0.8478/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.0.8478\WorkloadManifest.json Install Type: Msi
Host: Version: 8.0.0 Architecture: x64 Commit: 5535e31a71
.NET SDKs installed: 8.0.100 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found