webapi返回不带引号的字符串,解决自动加双引号的问题

返回类型改为HttpResponseMessage类型

1 [Route("api/TestControllers/test")]
2 [HttpGet]
3 public HttpResponseMessage Test()
4 {
5     HttpResponseMessage responseMessage = new HttpResponseMessage { Content = new StringContent("你要返回的字符串", Encoding.GetEncoding("UTF-8"), "text/plain") };
6          
7     return responseMessage;
8 }

 

posted @ 2016-07-05 14:28  a-fei  阅读(6115)  评论(3编辑  收藏  举报