是否有可能成为从自托管的网络API网页在一个窗口服务? [英] Is it possible to serve a web page from a self hosted web API in a windows service?
问题描述
我有一个完全正常的(TopShelf主办)窗口服务。我有一个简单的界面,这将返回当前的一些统计数据服务(保存在内存中)的要求。
I have a perfectly normal (TopShelf hosted) windows service. I have a requirement for a simple interface to the service which will return some current stats (held in memory).
我有一个狡猾的计划,自托管服务中的一个网站,我看到asp.net API具有自我主机功能。
I had a cunning plan to self-host a website within the service, and I see that the asp.net API has a self host functionality.
是否有可能颠覆系统API'ness并使其返回简单(虽然不是静态)的HTML浏览器可以直接读取?
Is it possible to subvert the 'API'ness of the system and have it return simple (though not static) HTML that a browser could read directly?
如果不是是否有任何其他选项或想法对于这种情况?
If not that are there any other options or ideas for this scenario?
推荐答案
是的。该测试网站 http://www.hypermediaapi.com 是使用自托管的WebAPI完成。它的来源是这里 https://github.com/darrelmiller/HypermediaApiSite
Yes. This test site http://www.hypermediaapi.com is done using self-hosted WebAPI. The source for it is here https://github.com/darrelmiller/HypermediaApiSite
这篇关于是否有可能成为从自托管的网络API网页在一个窗口服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!