.NET 实现
.NET Core:完全实现.NET Standard,可在Windows、macOS和Linux运行
.NET Framework:4.5以上实现.NET Standard,仅Windows。很多独有的框架,如WPF。
Mono:用于Android和所有Apple系统,驱动Xamarin和Unity
UWP:统一微软各类设备(Windows、Xbox、Windows Phone等)
https和http协议
Web API Post实例:
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WebAPI_Core.Models;
namespace WebAPI_Core.Controllers
{
[Route("api/[controller]")] //路由
[ApiController]
public class ValuesController : ControllerBase
{
private static Dictionary<string, AddRequest> DB = new Dictionary<string, AddRequest>();
// POST api/<ValuesController>
[HttpPost]
public AddResponse Post([FromBody] AddRequest req)
{
AddResponse resp = new AddResponse();
try
{
DB.Add(req.ISBN,req);
resp.ISBN = req.ISBN;
resp.message = "交易成功";
resp.result = "success";
}catch(Exception ex)
{
Console.WriteLine(ex.ToString());
resp.ISBN = "";
resp.message = "交易失败";
resp.result = "fail";
}
return resp;
}
/* AddRequest
{
"ISBN": "1",