当我将我的工作ASP.NET CORE 2.2应用程序部署到我的本地 IIS 10 时,它给了我异常
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: Object already exists
at Internal.NativeCrypto.CapiHelper.CreateCSP(CspParameters parameters, Boolean randomKeyContainer, SafeProvHandle& safeProvHandle)
at Internal.NativeCrypto.CapiHelper.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeProvHandle()
at System.Security.Cryptography.RSACryptoServiceProvider.get_SafeKeyHandle()
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 keySize, CspParameters parameters, Boolean useDefaultKeySize)
at System.Security.Cryptography.RSACryptoServiceProvider..ctor(CspParameters parameters)
at SamoletBot.Utilities.RSAHelper.GetRSAFromString(String pemstr) in D:\Projects\SamoletBot22\SamoletBot\SamoletBot.Utilities\RSAHelper.cs:line 23
Run Code Online (Sandbox Code Playgroud)
这是相关的代码:
CspParameters cspParameters = new CspParameters();
cspParameters.KeyContainerName = "TheContainer";
cspParameters.Flags = CspProviderFlags.UseMachineKeyStore;
RSACryptoServiceProvider rsaKey;
rsaKey = new RSACryptoServiceProvider(cspParameters);
Run Code Online (Sandbox Code Playgroud)
在最后一行抛出异常
阅读后我得出结论,这是由于 RSA 容器权限而发生的,我看到了几个答案,它们使用它来向每个用户授予权限。
CryptoKeyAccessRule rule = new CryptoKeyAccessRule("everyone", CryptoKeyRights.FullControl, AccessControlType.Allow);
Run Code Online (Sandbox Code Playgroud)
问题是CryptoKeyAccessRule找不到。我已经进口了using System.Security.AccessControl。查看Microsoft …
基本上我想做与这里相同的事情: https: //stackoverflow.com/a/16274992/4138686,但是在 EF Core 3.1.3 中使用这个答案给了我
System.InvalidOperationException: LINQ 表达式 '(GroupByShaperExpression: KeySelector: (r.Price), ElementSelector:(EntityShaperExpression: EntityType: RetailerRate ValueBufferExpression: (ProjectionBindingExpression: EmptyProjectionMember) IsNullable: False ) ) .OrderByDescending(r => r.CreatedAt)'无法翻译。以可翻译的形式重写查询,或者通过插入对 AsEnumerable()、AsAsyncEnumerable()、ToList() 或 ToListAsync() 的调用来显式切换到客户端计算。有关详细信息,请参阅https://go.microsoft.com/fwlink/?linkid=2101038 。
这是代码:
await _db.RetailerRates
.GroupBy(r => r.Price)
.Select(g => g.OrderByDescending(r => r.CreatedAt).First())
.ToListAsync();
Run Code Online (Sandbox Code Playgroud)
有没有办法根据 EF Core 3.1 中每个组的日期检索第一个元素?
我知道您可以执行以下操作:
let name = 'testFunc'
let functions = {
[name] () {...}
}
Run Code Online (Sandbox Code Playgroud)
但是否可以做这样的事情:
export function [name] () {...}
我不确定这个问题是否属于SO,首先我认为这是我的代码中的一个问题,但后来我尝试了Postman并得到了相同的错误响应.我正在尝试使用Bitstamp API执行买单(或卖出,它是相同的),但API返回"POST Only Endpoint",但我100%肯定request.Method = "POST".我已经实现了帐户余额 API调用,这也是POST,一切都很好.但对于一些人来说,我无法让买/卖API调用工作.
我有一个长时间运行的方法,我决定使用 HangFire 在后台执行并通过仪表板管理它们。我使用以下代码设置了仪表板和 Hangfire 本身:
HangFireConfiguration.cs
public static class HangFireConfiguration
{
public static string DashboardUrl = "/tasks";
public static void Configure(IAppBuilder app)
{
GlobalConfiguration.Configuration.UseSqlServerStorage("DefaultConnection");
var options = new DashboardOptions
{
Authorization = new[]
{
new HangFireAuthorization()
}
};
app.UseHangfireDashboard(DashboardUrl, options);
app.UseHangfireServer(new BackgroundJobServerOptions()
{
//ShutdownTimeout = TimeSpan.FromHours(24)
});
}
}
Run Code Online (Sandbox Code Playgroud)
HangFireAuthorization.cs
public class HangFireAuthorization : IDashboardAuthorizationFilter
{
public static string DashboardUrl = "/tasks";
public bool Authorize([NotNull] DashboardContext context)
{
if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated)
{
return HttpContext.Current.User.IsInRole("admin");
}
return false; …Run Code Online (Sandbox Code Playgroud) c# ×3
asp.net-core ×1
asp.net-mvc ×1
ecmascript-6 ×1
ef-core-3.1 ×1
group-by ×1
hangfire ×1
iis ×1
javascript ×1
postman ×1
rsa ×1