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

Posted sntetwt

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 源代码下载

以上是关于WPF 使用HttpListener搭建本地web服务器的主要内容,如果未能解决你的问题,请参考以下文章