C#简易http服务器/http响应实现(system.net.http)

 注: 本文使用了 .net库

System.Net.Http

以下是正文:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.WebSockets;
using System.Runtime.Remoting.Contexts;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using System.Xml;
using Azure;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
//using Microsoft.Graph.Models;
//using Microsoft.Graph;
///using Microsoft.Graph.Models;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            HttpClient cs = new HttpClient();

            HttpListener h = new HttpListener();

            h.Prefixes.Add("http://127.0.0.1:11234/");//创建监听地址
            h.Start();//启动监听



            WebClient ap = new WebClient();
          

你可能感兴趣的:(c#,http,服务器)