C# 如何使用https在本地运行内置版本的aspnet核心网站
我正在开发一个asp网络核心网站,并使用C# 如何使用https在本地运行内置版本的aspnet核心网站,c#,asp.net-core,https,.net-5,C#,Asp.net Core,Https,.net 5,我正在开发一个asp网络核心网站,并使用app.UseHttpsRedirection() 当我在debug from VS中启动网站时,我可以在https中从https://localhost:5001/ 但是,如果我在发布版中构建它,然后运行可执行文件,当我尝试从https://localhost:5001/我收到了这个消息,肯定与证书问题有关: System.Security.Cryptography.CryptographicException: The payload was inva
app.UseHttpsRedirection()代码>
当我在debug from VS中启动网站时,我可以在https中从https://localhost:5001/
但是,如果我在发布版中构建它,然后运行可执行文件,当我尝试从https://localhost:5001/
我收到了这个消息,肯定与证书问题有关:
System.Security.Cryptography.CryptographicException: The payload was invalid.
at Microsoft.AspNetCore.DataProtection.Cng.CbcAuthenticatedEncryptor.DecryptImpl(Byte* pbCiphertext, UInt32 cbCiphertext, Byte* pbAdditionalAuthenticatedData, UInt32 cbAdditionalAuthenticatedData)
at Microsoft.AspNetCore.DataProtection.Cng.Internal.CngAuthenticatedEncryptorBase.Decrypt(ArraySegment`1 ciphertext, ArraySegment`1 additionalAuthenticatedData)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked)
at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData)
at Microsoft.AspNetCore.Session.CookieProtection.Unprotect(IDataProtector protector, String protectedText, ILogger logger)
10:40:47||0HM8IV1M7U2V2:00000005|Microsoft.AspNetCore.Session.SessionMiddleware|WRN|Error unprotecting the session cookie.
运行在发行版中编译的可执行文件时,要在本地浏览我的网站,我必须做些什么?因此,您的项目是基于.NET Framework([.NET]
)、.NET Core([.NET Core]
)和.NET 5([.NET-5]
)构建的?有趣的是…我使用了.NET5。我已经从你的问题中删除了其他误导性标记。buildHi@Neil发行版中是否缺少证书。有配置文件,exe,DLL和PDB,但我相信没有证书。如何生成一个?