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

准备工作

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

调用示例:
一、启动服务:new Micro.Listener.ListenerSync(8080).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 源代码下载

posted @ 2018-07-06 21:17  microsoftzhcn  阅读(1872)  评论(0编辑  收藏  举报