问题
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