可一个WinForms / WPF应用程序的行为作为HTTP服务器? [英] Can a Winforms/WPF app act as HTTP server?

查看:419
本文介绍了可一个WinForms / WPF应用程序的行为作为HTTP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的WinForms桌面。现在我有一个人想从其他机器访问数据的请求。首先,我想到一个普通的客户机/服务器应用程序,但现在我觉得最好的是,如果应用程序可以作为HTTP服务器,并发送HTML所连接的浏览器。

I have a desktop written with Winforms. Now I have requests that people want to access the data from other machines. First I thought about a regular Client/Server app but now I think best would be if the app could act as HTTP server and send HTML to connected browsers.

有谁知道是否有可用的HTTP服务器的功能添加到应用程序库?理想情况下是能够为ASP.NET内容。

Does anybody know if there is a library available to add HTTP server functionality to an app? Ideally it would be able to serve ASP.NET content.

推荐答案

要承载ASP.NET内容(比如.aspx页)从您自己的应用程序(没有IIS),使用的类在 System.Web.Hosting 命名空间。

To host ASP.NET content (such as .aspx pages) from your own application (without IIS), use the classes in the System.Web.Hosting namespace.

这个典型的例子是使用随Visual Studio的(根据卡西尼)的独立测试Web服务器。来源$ C ​​$ C的卡西尼号就可以在这里找到:的http://blogs.msdn.com/dmitryr/archive/2008/10/03/cassini-for-framework-3-5.aspx

The canonical example usage of this is the standalone testing web server that comes with Visual Studio (based on "Cassini"). Source code for "Cassini" it is available here: http://blogs.msdn.com/dmitryr/archive/2008/10/03/cassini-for-framework-3-5.aspx

下面是关于这个问题的(有些过时)MSDN文章: HTTP:/ /msdn.microsoft.com/en-us/magazine/cc188791.aspx

Here is a (somewhat dated) MSDN article on the subject: http://msdn.microsoft.com/en-us/magazine/cc188791.aspx

由于IIS是一个长镜头,期待你的服务器是一样健壮。所以一定要仔细评估你的需求和管理您的期望:)

Expecting your server to be as robust as IIS is a long shot. So be sure to carefully evaluate your needs and manage your expectations :)

这篇关于可一个WinForms / WPF应用程序的行为作为HTTP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆