Is it possible to serve a web page from a self hosted web API in a windows service?

拟墨画扇 提交于 2019-12-10 05:21:35

问题


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).

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.

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?


回答1:


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



来源:https://stackoverflow.com/questions/17450846/is-it-possible-to-serve-a-web-page-from-a-self-hosted-web-api-in-a-windows-servi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!