web api返回的是标准格式UTC时间,如果要转成我们需要的格式,可以在WebApiConfig.cs的Register函数中新增以下配置来定义返回的时间类型格式: //配置返回的时间类型数据格式 GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Converters.Add( new Newtonsoft.Json.Converters.IsoDateTimeConverter() {…
public HttpResponseMessage Get(string imageName, int width, int height) { Image img = GetImage(imageName, width, height); MemoryStream ms = new MemoryStream(); img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); HttpResponseMessage result = new Htt…
webapi接口统一返回请求时间: public class BaseController : ControllerBase { protected ReturnResult<T> Result<T>(Func<ReturnResult<T>> fun) { ReturnResult<T> result = null; var stopWatch = new Stopwatch(); stopWatch.Start(); try { result…