webapi返回字符串,解决自动加双引号或下划线的问题

返回类型改为HttpResponseMessage类型

[HttpGet]
public HttpResponseMessage Test()
{
    HttpResponseMessage responseMessage = new HttpResponseMessage { Content = new StringContent("你要返回的字符串", Encoding.GetEncoding("UTF-8"), "text/plain") };
         
    return responseMessage;
}

  

 

posted @ 2018-01-12 16:40  米斯特唐  阅读(329)  评论(0编辑  收藏  举报