• 大小: 0.20M
    文件类型: .zip
    金币: 2
    下载: 3 次
    发布日期: 2021-02-23
  • 语言: C#
  • 标签: restful  

资源简介

请右键 以管理员身份运行程序

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace RestFulClient
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.title = “Restful客户端Demo测试“;

            RestClient client = new RestClient();
            client.EndPoint = @“http://127.0.0.1:7788/“;

            client.Method = EnumHttpVerb.GET;
            string resultGet = client.HttpRequest(“PersonInfoQuery/王二麻子“);
            Console.WriteLine(“GET方式获取结果:“ + resultGet);

            client.Method = EnumHttpVerb.POST;
            Info info = new Info();
            info.ID = 1;
            info.Name = “张三“;
            client.PostData = JsonConvert.Serializeobject(info);//JSon序列化我们用到第三方Newtonsoft.Json.dll
            var resultPost = client.HttpRequest(“PersonInfoQuery/Info“);
            Console.WriteLine(“POST方式获取结果:“ + resultPost);
            Console.Read();
        }
    }

    [Seri

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\
     文件         378  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\.gitattributes
     目录           0  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RefDLL\
     文件      504832  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RefDLL\Newtonsoft.Json.dll
     文件        1474  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFul.sln
     目录           0  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\
     文件         184  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\App.config
     文件        1196  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\Program.cs
     目录           0  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\Properties\
     文件        1298  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\Properties\AssemblyInfo.cs
     文件        4185  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\RestClient.cs
     文件        2796  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulClient\RestFulClient.csproj
     目录           0  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\
     文件         184  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\App.config
     文件        2594  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\IPersonInfoQuery.cs
     文件         728  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\Info.cs
     文件        2007  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\PersonInfoQueryServices.cs
     文件        1124  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\Program.cs
     目录           0  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\Properties\
     文件        1300  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\Properties\AssemblyInfo.cs
     文件        2953  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\RestFulService.csproj
     文件         849  2018-04-08 06:47  Restful-Service-And-Restful-Client-master\RestFulService\User.cs

评论

共有 条评论