Identityserver4: AddDeveloperSigningCredential() issue with ASP.NET Core 2.2 in-process hosting

Created on 14 Feb 2019  路  7Comments  路  Source: IdentityServer/IdentityServer4

Your sample code in document:
.AddDeveloperSigningCredential()
Is not working on .Net Core 2.2 as GetCurrentDirectory will return the IIS process folder location VS the base folder of the App.

Relevant parts of the log file

<log goes here>

-- Suggested code??
var filename = Path.Combine(AppContext.BaseDirectory, "tempkey.rsa");
.AddDeveloperSigningCredential(filename: filename)

bug report

Most helpful comment

Confirmed that it works as expected on 2.2.2

All 7 comments

Does BaseDirectory work the same on .NET Core as Full .NET?

Starting with ASP.NET Core 2.2 there is an in-process hosting option for IIS. If this is used (which seems to be the default in the new templates) the current directory changes to the IIS directory.

Will give the AppContext a try.

AppContext.BasePath is unfortunately not quite the same. It points to /bin/debug as opposed to the content root.

Needs more investigation. You can always pass in an explicit file name to AddDeveloperSigningCredential.

According to David Fowler this has been fixed in 2.2

https://twitter.com/davidfowl/status/1096296090670837760

Since this is a 2.2 only problem, it seems there is nothing we have to do here.

Confirmed that it works as expected on 2.2.2

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings