Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnauthorizedAccessException: Access to the path 'c:\windows\system32\inetsrv\tempkey.rsa' is denied."

I was trying to deploy an IdentityServer 4 app with ASP.NET core 2.2 into IIS in my local machine (Windows 10) and get the error:

An error occurred while starting the application. UnauthorizedAccessException: Access to the path 'c:\windows\system32\inetsrv\tempkey.rsa' is denied."

Its working with debugging mode but getting above while deploying in IIS.

Identity server 4 version - 2.3.2

Asp.net core 2.2

IIS 10.0.16

Can anyone help to solve this?

like image 341
Prabu Avatar asked Sep 19 '25 04:09

Prabu


1 Answers

I had the same error and it was coming from the call to AddDeveloperSigningCredential() inside configure services. When I changed it to AddDeveloperSigningCredential( persistKey: false ), the error went away.

Here is entire function call block

public void ConfigureServices( IServiceCollection services )
{
    services.AddIdentityServer()
    .AddDeveloperSigningCredential( persistKey:false)
    .AddInMemoryApiResources( Config.GetApiResources() )
    .AddInMemoryClients( Config.GetClients() );
}
like image 99
J Cox Avatar answered Sep 21 '25 00:09

J Cox