Yes, you can by self hosting web API into your windows form application like demonstrated here
The second option is to use ASP.NET 5 self-hosting but it is still in beta and has no good documentation yet.
Edit 1:
To support viewing pages using Web API 2 you need to follow the following steps:
First, let JSON formatter handle HTML requests like the following
config.Routes.MapHttpRoute(
"API Default", "api/{controller}/{id}",
new { id = RouteParameter.Optional });
// Add the supported media type.
config.Formatters.JsonFormatter.SupportedMediaTypes.Add(new MediaTypeHeaderValue("text/html"));
Second, Save the desired html template files on disk with placeholders that will be replaced with your actual data at runtime and change the controller like below
public String GetAllProducts()
{
//Should be loaded from HTML template file ex. Products.html
string html = "<html><body><table border=\"2\"><tr><th>ID</th><th>Name</th><th>Category</th><th>Price</th><tr>{{placeholder}}</table></body></html>";
StringBuilder sb = new StringBuilder();
foreach (var item in products)
{
sb.AppendLine("<tr><td>" + item.Id + "</td><td>" + item.Name + "</td><td>" + item.Category + "</td><td>" + item.Price + "</td></tr>");
}
return html.Replace("{{placeholder}}", sb.ToString());
}
Note: If you don't like the default JSON formatter you can write your own like there did tn this project
view the logfile in a browserusing a winform application?WebBrowserContorlin windows forms.web servicewhich will read that file and return the data to you. You can also achieve it by making a simplewebformand throw data usingResponse.Write. But web service is preferable.