gpt4 book ai didi

.net-core - System.PlatformNotSupportedException : 'Operation is not supported on this platform.' when upgrading ServiceStack to .netcore 2.0

转载 作者:行者123 更新时间:2023-12-03 21:29:38 30 4
gpt4 key购买 nike

我们在一个尚未上线的开源项目中使用 ServiceStack(.netcore) 作为我们的 Web 服务层。我们正计划迁移到 .netcore2.0。我们于 11 月 17 日从 https://github.com/ServiceStack/ServiceStack 下载了 servicestacks 的 master 分支。用于检测。但是由于以下异常,我们被卡住了,servicestack 项目没有启动。

我们对此做了一些研究,发现 .Net Core 没有 toXmlString() 和 fromXmlString 方法。请查看 https://github.com/dotnet/core/issues/874https://github.com/dotnet/corefx/issues/23686 .

需要服务堆栈社区的帮助。

$exception {System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at ServiceStack.RsaUtils.ToPrivateRSAParameters(String privateKeyXml) in F:\ExpressBase\ExpressBase.Core\ServiceStack.Core\ServiceStack.Client\CryptUtils.cs:line 85
at ServiceStack.Auth.JwtAuthProviderReader.set_PrivateKeyXml(String value) in F:\ExpressBase\ExpressBase.Core\ServiceStack.Core\ServiceStack\Auth\JwtAuthProviderReader.cs:line 148
at ExpressBase.ServiceStack.AppHost.Configure(Container container) in F:\ExpressBase\ExpressBase.Core\ExpressBase.ServiceStack\Startup.cs:line 94
at ServiceStack.ServiceStackHost.Init() in F:\ExpressBase\ExpressBase.Core\ServiceStack.Core\ServiceStack\ServiceStackHost.cs:line 200
at ServiceStack.NetCoreAppHostExtensions.UseServiceStack(IApplicationBuilder app, AppHostBase appHost) in F:\ExpressBase\ExpressBase.Core\ServiceStack.Core\ServiceStack\AppHostBase.NetCore.cs:line 224
at ExpressBase.ServiceStack.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in F:\ExpressBase\ExpressBase.Core\ExpressBase.ServiceStack\Startup.cs:line 74} System.PlatformNotSupportedException

这是我们的 Startup.cs 中生成异常的行。

var jwtprovider = new MyJwtAuthProvider(AppSettings)
{
HashAlgorithm = "RS256",
PrivateKeyXml = EbLiveSettings.PrivateKeyXml,
PublicKeyXml = EbLiveSettings.PublicKeyXml,
RequireSecureConnection = false,
//EncryptPayload = true,
CreatePayloadFilter = (payload, session) =>
{
payload["sub"] = (session as CustomUserSession).UserAuthId;
payload["cid"] = (session as CustomUserSession).CId;
payload["uid"] = (session as CustomUserSession).Uid.ToString();
payload["wc"] = (session as CustomUserSession).WhichConsole;
},
ExpireTokensIn = TimeSpan.FromHours(10),
ExpireRefreshTokensIn = TimeSpan.FromHours(12),
PersistSession = true,
SessionExpiry = TimeSpan.FromHours(12)
};

私钥和公钥值从 appsettings.json 加载到 EbLiveSettings。

appsettings.json 中的行是
"JwtConfig": {
"PublicKeyXml": "<RSAKeyValue><Modulus>ip...7BfGi98ObWqKnD8o4pv....JQklgmblCs=</Modulus><Exponent>AQAB</Exponent><P></P><Q></Q><DP></DP><DQ></DQ><InverseQ></InverseQ><D></D></RSAKeyValue>",
"PrivateKeyXml": "<RSAKeyValue><Modulus>ip....lss7WqKnD8o4bKTp....IKbK2gaagCQ==</DP><DQ>BKOC....zlic+FQ==</DQ><InverseQ>JeIPWX....A==</InverseQ><D>iHU....cTrKeEGd</D></RSAKeyValue>"
},

最佳答案

你能不能用 master 的最新源代码重试,因为我已经恢复了一些 RSA polyfills for .NET Core .

关于.net-core - System.PlatformNotSupportedException : 'Operation is not supported on this platform.' when upgrading ServiceStack to .netcore 2.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47387917/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com