webApi 禁用xml输出格式

  protected void Application_Start(object sender, EventArgs e)
        {
            //在应用程序启动时注册路由映射
            WebAPIConfig.Register(GlobalConfiguration.Configuration);
            //默认JSON
            GlobalConfiguration.Configuration.Formatters.XmlFormatter.SupportedMediaTypes.Clear();
        }

 

posted @ 2016-10-17 13:08  博客园董事长  阅读(386)  评论(0编辑  收藏  举报