Base solution for your next web application
Open Closed

Tempkey.rsa error #6832


User avatar
0
byeniceri created

Hi

I published aspnetzero demo project to our test environment. When I call the web.mvc project from browser I get following error. The log file is below. There is no tempkey.rsa file in published files.

Application startup exception: System.UnauthorizedAccessException:** Access to the path 'C:\inetpub\wwwroot\dashboard\tempkey.rsa' is denied.** at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost) at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential(IIdentityServerBuilder builder, Boolean persistKey, String filename) at AutoSenseDemo.Web.IdentityServer.IdentityServerRegistrar.Register(IServiceCollection services, IConfigurationRoot configuration) at AutoSenseDemo.Web.Startup.Startup.ConfigureServices(IServiceCollection services) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() Hosting environment: Production Content root path: C:\inetpub\wwwroot\dashboard Now listening on: http://127.0.0.1:43126 Application started. Press Ctrl+C to shut down.


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Does the file C:\inetpub\wwwroot\dashboard\tempkey.rsa exist? Looks like a problem with iis.

  • User Avatar
    0
    byeniceri created

    hi

    There is no temkey.rsa file in published files.

  • User Avatar
    0
    maliming created
    Support Team

    Sorry, I feel like a IIS permission issue. The application does not have permission to create new files.

    Try to manually copy the tempkey.rsa file generated during development to the IIS website directory.

    https://stackoverflow.com/questions/48933369/access-denied-file-in-asp-net-core?rq=1

  • User Avatar
    0
    byeniceri created

    It works thank you

  • User Avatar
    0
    kansoftware created

    Hi,

    I have deployed the application on AWS and i am getting the same error for tempkey.rsa. can you please help in understanding the use of this file

    thanks, Harshit

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kansoftware

    This file is used by IdentityServer. If you don't use IdentityServer, you can disable it in appsettings.json file. If you are using it, you need to provide write access to your app for the mentioned folder. I'm not sure how to do that in AWS.