0
我有一个4.5 net fw的库。我需要做同样的事情,但对于网络核心。NetFramework转换为Net Core(HttpWebRequest)
大啤酒人可同时修复这个..
Code from VS with errors (screen) 我的代码:
string returnData = String.Empty;
var webRequest = HttpWebRequest.Create(url) as HttpWebRequest;
if (webRequest != null)
{
webRequest.Accept = "*/*";
webRequest.UserAgent = ".NET";
webRequest.Method = method;
webRequest.ContentType = "application/json";
webRequest.Host = "coinbase.com";
string nonce = Convert.ToInt64(DateTime.Now.Ticks).ToString();
string message = nonce + url;
string signature = HashEncode(HashHMAC(StringEncode(API_SECRET), StringEncode(message)));
var whc = new WebHeaderCollection();
whc.Add("ACCESS_KEY: " + API_KEY);
whc.Add("ACCESS_SIGNATURE: " + signature);
whc.Add("ACCESS_NONCE: " + nonce);
webRequest.Headers = whc;
using (WebResponse response = webRequest.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(stream);
returnData = reader.ReadToEnd();
}
}
}
相同:https://gyazo.com/be9f84174ff7cef4d6b75a3dfdf8c094 – Camilson
@Camilson:对不起,我的朋友。我使用了.Net Framework 4.6。我已经检查过,真的没有错误。 – Tomato32
好吧,但这必须是NET CORE。我需要在Linux上运行此代码 – Camilson