zoukankan      html  css  js  c++  java
  • .net framework 4.0上跑webapi 1.0

    public static class WebApiConfig
        {
            public static void Register(HttpConfiguration config)
            {
                // Web API 配置和服务
    
                // Web API 路由
                //config.MapHttpAttributeRoutes();
    
                //config.Routes.MapHttpRoute(
                //    name: "DefaultApi",
                //    routeTemplate: "api/{controller}/{id}",
                //    defaults: new { id = RouteParameter.Optional }
                //);
                config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new
                {
                    id = RouteParameter.Optional
                }
                );
                // Uncomment the following line of code to enable query support for actions with an IQueryable or IQueryable<T> return type.
                // To avoid processing unexpected or malicious queries, use the validation settings on QueryableAttribute to validate incoming queries.
                // For more information, visit http://go.microsoft.com/fwlink/?LinkId=279712.
                //config.EnableQuerySupport();
    
                // To disable tracing in your application, please comment out or remove the following line of code
                // For more information, refer to: http://www.asp.net/web-api
                config.EnableSystemDiagnosticsTracing();
            }
        }
      public class WebApiApplication : System.Web.HttpApplication
        {
            protected void Application_Start()
            {
                WebApiConfig.Register(GlobalConfiguration.Configuration);
            }
        }

    webapi引用选择4.x....的

  • 相关阅读:
    跨域抓取360搜索结果
    css的圣杯布局
    css的双飞翼布局
    C#WebBroswer控件的使用
    使用Chart控件进行实时监控
    GzipStream的简单使用压缩和解压
    poj 1611 The Suspects
    hdu 1856 More is better
    hdu 1232
    UvaOJ 10167
  • 原文地址:https://www.cnblogs.com/gaocong/p/8692585.html
Copyright © 2011-2022 走看看