Identityserver4不工作的IP地址

问题描述:

我已经使用IdentityServer4与asp网络核心Web,在localhost:50481中调试时都工作正常,但是当我在同一台计算机上使用myipaddress:50481并且调试模式时,它失败。我不使用临时证书,相反,我创建了一个RSA证书:Identityserver4不工作的IP地址

.AddSigningCredential(Config.GetSigningCertificate()) 

    public static RsaSecurityKey GetSigningCertificate() 
    { 
    var filename = Path.Combine(Directory.GetCurrentDirectory(), "certificateKey.rsa"); 

     if (File.Exists(filename)) 
     { 
      var keyFile = File.ReadAllText(filename); 
      var tempKey = JsonConvert.DeserializeObject<TemporaryRsaKey>(keyFile, new JsonSerializerSettings() { ContractResolver = new RsaKeyContractResolver() }); 

      return CreateRsaSecurityKey(tempKey.Parameters, tempKey.KeyId); 
     } 
     else 
     { 
      var key = CreateRsaSecurityKey(); 

      RSAParameters parameters; 

      if (key.Rsa != null) 
       parameters = key.Rsa.ExportParameters(includePrivateParameters: true); 
      else 
       parameters = key.Parameters; 

      var tempKey = new TemporaryRsaKey 
      { 
       Parameters = parameters, 
       KeyId = key.KeyId 
      }; 

      File.WriteAllText(filename, JsonConvert.SerializeObject(tempKey, new JsonSerializerSettings() { ContractResolver = new RsaKeyContractResolver() })); 

      return CreateRsaSecurityKey(tempKey.Parameters, tempKey.KeyId); 
     } 
    } 

我还检查本地主机的ip地址,并在jwks,它们是匹配的。

当我将项目发布到本地IIS时,localhost不起作用,出现500内部错误。

都在我的应用程序的URL是“http://localhost:50481

感谢您提前帮助。

我不得不说这是一个愚蠢的错误,我没有注意到authConfig,

let config; 

if (window.location.hostname === 'localhost') { 
    config = configForDevelopment; 
} else { 
    config = configForProduction; 
} 

当我使用的IP地址,配置的是切换到督促,localhost更改我的IP地址是有意义的。

希望可以别人。