config.Formatters.Add(new System.Net.Http.Formatting.HtmlMediaTypeFormatter());
[HttpGet] public HttpResponseMessage Get() { string html = "
RouteTable.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } );
注意:确保在浏览器中修改ContentType为text/html,而不是默认的application/json。