【问题标题】:Could not find file 'D:\home\site\wwwroot\tempkey.rsa'找不到文件“D:\home\site\wwwroot\tempkey.rsa”
【发布时间】:2020-02-25 20:07:55
【问题描述】:

这导致了 Startup.cs 中的问题:

services.AddIdentityServer() .AddDeveloperSigningCredential()

我尝试手动插入 tempkey.rsa 文件夹,但无法解决问题。

请告诉我如何处理这个问题?

FileNotFoundException: 找不到文件 'D:\home\site\wwwroot\tempkey.rsa'。 System.IO.FileStream.OpenHandle(FileMode 模式,FileShare 共享, FileOptions 选项)

FileNotFoundException: Could not find file 'D:\home\site\wwwroot\tempkey.rsa'.

System.IO.FileStream.OpenHandle(FileMode 模式, FileShare 共享, FileOptions 选项)System.IO.FileStream..ctor(字符串路径,FileMode 模式、FileAccess 访问、FileShare 共享、int bufferSize、FileOptions 选项)System.IO.StreamWriter..ctor(字符串路径,布尔追加, 编码编码,int bufferSize) System.IO.StreamWriter..ctor(string 路径)System.IO.File.WriteAllText(字符串路径,字符串内容) Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential(IIdentityServerBuilder builder, bool persistKey, 字符串文件名) IdentityServer.Startup.ConfigureServices(IServiceCollection 服务) 在 Startup.cs System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection 服务) Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

【问题讨论】:

  • 发布您的应用程序后会发生这种情况吗?
  • 你是怎么解决这个问题的?

标签: azure .net-core identityserver4


【解决方案1】:

tempkey.rsa 不是文件夹。它是一个临时密钥,身份服务器用它签署它的令牌。 当您运行应用程序时,此临时密钥会在项目根文件夹中自动生成。临时您可以将 this temp key 粘贴到您的 .csproj 文件旁边,看看它会很好地工作。

【讨论】:

  • 这没有任何意义。错误是找不到文件,即使它就在那里
猜你喜欢
  • 2021-12-22
  • 2018-01-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-13
  • 1970-01-01
  • 2022-01-19
相关资源
最近更新 更多