s.k*_*aul 1 .net-4.6.1 asp.net-core
我正在尝试开发 ASP.NET 5 应用程序。这是一个类,看起来不错(没有红色卷曲下划线)。但是当我尝试构建时,它给出了错误 -SymmetricAlgorithm' does not contain a definition for 'Create'
using System;
using System.IO;
using System.Security.Cryptography;
namespace SalesBook
{
public static class Encryptor
{
private static byte[] EncryptString(string data)
{
byte[] byteData = Common.GetByte(data);
SymmetricAlgorithm algo = SymmetricAlgorithm.Create();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用.net 4.6.1。有什么帮助吗?
该方法尚未移植到.NET Core。推荐的替代方法是使用Create与您需要的算法相关的特定方法:
var algorithm = Aes.Create();
Run Code Online (Sandbox Code Playgroud)
在 CoreCLR 上,它将根据您的操作系统环境自动确定并返回最佳实现。
如果不需要 .NET Core 支持,可以从 project.json 中删除dnxcore50/ 。dotnet5.4
| 归档时间: |
|
| 查看次数: |
1701 次 |
| 最近记录: |