所以我一直在用 C# 摆弄 Web 响应和请求,当我尝试运行该程序时遇到了问题。我的其中一行代码:
var response = await httpClient.SendAsync(request);
Run Code Online (Sandbox Code Playgroud)
方法制作中需要异步
private static void Main(string[] args)
Run Code Online (Sandbox Code Playgroud)
进入
private static async Task Main(string[] args)
Run Code Online (Sandbox Code Playgroud)
看起来没有错误,但是在构建时,我收到错误消息:
程序不包含适合入口点的静态“Main”方法。
这是我的代码
private static async Task Main(string[] args)
{
try
{
/*HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://billing.roblox.com/v1/gamecard/redeem");
request.Method = "POST";
request.ContentType = "application/json";
request.Accept = "application/json";
JsonExtensionDataAttribute data = new JsonExtensionDataAttribute();
data = '3335996838'*/
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://billing.roblox.com/v1/gamecard/redeem"))
{
request.Headers.TryAddWithoutValidation("Accept", "application/json");
request.Content = new StringContent("3335996838", Encoding.UTF8, "application/json"); …Run Code Online (Sandbox Code Playgroud)