IAppBuilder程序集引用问题

时间:2014-09-22 19:21:19

标签: c# asp.net asterisk

我试图找出我无法使用IAppBuilder的原因。我已经为我的项目添加了许多程序集,但仍然没有找到错误“找不到类型或命名空间名称'IAppBuilder'(你是否缺少using指令或程序集引用?)” 我的目标是使用AsterNet库连接Asterisk服务器并创建会议室。我正在使用的代码是:

 using System;
 using Microsoft.Owin;
 using Owin;
 using System.Net.Http;
 using System.Web.Http;
 using System.Web.Http.Routing;
 using AsterNET;
 using AsterNET.ARI;
 using AsterNET.ARI.SimpleConfExample.REST;
 using Microsoft.AspNet.SignalR.Owin;

 namespace AsterNET.ARI.SimpleConfExample.REST

{
public class Startup
{
    // This code configures Web API. The Startup class is specified as a type
    // parameter in the WebApp.Start method.

    public void Configuration(IAppBuilder appBuilder)
    {
        // Configure Web API for self-host. 
        var config = new HttpConfiguration();

        //config.Routes.MapHttpRoute(
        //    name: "DefaultApi",
        //    routeTemplate: "api/{controller}/{id}",
        //    defaults: new { id = RouteParameter.Optional }
        //);

        //config.Routes.MapHttpRoute(
        //    name: "DefaultApiWithAction",
        //    routeTemplate: "api/{controller}/{id}/{action}",
        //    defaults: new { action = "Get" },
        //    constraints: new { HttpCons}
        //);

        config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}/{action}"
        );

        config.Routes.MapHttpRoute(
            name: "DefaultApiWithId",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { action = "Get" },
            constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) }
        );

        config.Routes.MapHttpRoute(
            name: "DefaultApiGet",
            routeTemplate: "api/{controller}/",
            defaults: new { action = "Get" },
            constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Get) }
        );

        config.Routes.MapHttpRoute(
            name: "DefaultApiPost",
            routeTemplate: "api/{controller}/",
            defaults: new { action = "Post" },
            constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Post) }
        );

        config.Routes.MapHttpRoute(
            name: "DefaultApiDelete",
            routeTemplate: "api/{controller}/{id}",
            defaults: new { action = "Delete" },
            constraints: new { httpMethod = new HttpMethodConstraint(HttpMethod.Delete) }
        );
        appBuilder.UseWebApi(config);
    }
} 
}

0 个答案:

没有答案