WPF 使用HttpListener搭建本地web服务器

准备工作

using Micro.Listener 类(Micro.Listener.dll)下载

调用示例:
一、启动服务:new Micro.Listener.ListenerSync(8181).Start();

二、资源调用:
1、HTML:webBrower.Source = new Uri("http://localhost:8080/res/template.html");
2、CSS/JS:<link href="http://localhost:8080/res/style.css" rel="stylesheet" />
3、图片:<img src="http://localhost:8080/res/logo.png"/> 

Micro.Listener.dll 文件下载

Micro.Listener 源代码下载

猜你喜欢

转载自www.cnblogs.com/sntetwt/p/9275590.html