简体   繁体   English

找不到类型或名称空间名称“ HttpConfiguration”(是否缺少using指令或程序集引用?

[英]The type or namespace name 'HttpConfiguration' could not be found (are you missing a using directive or an assembly reference?

Error :=- AuthorizationServer.Api/Startup.cs(17,17): Error CS0246: The type or namespace name 'HttpConfiguration' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (AuthorizationServer.Api) 错误:=- AuthorizationServer.Api / Startup.cs(17,17):错误CS0246:找不到类型或名称空间名称“ HttpConfiguration”(您是否缺少using指令或程序集引用?)(CS0246)(AuthorizationServer .api)

i am using visual studio community for mac and first error was system.web.http error so i follow the approach listed here:- 我在Mac上使用Visual Studio社区,并且第一个错误是system.web.http错误,所以我遵循此处列出的方法:-

MVC 5 on Mono: Could not load file or assembly 'System.Web.Entity' or one of its dependencies Mono上的MVC 5:无法加载文件或程序集'System.Web.Entity'或其依赖项之一

Installed System.Web.Common.Http But Following Error It is Showing In my startup.cs File How to resolve This ? 安装了System.Web.Common.Http,但是在我的startup.cs文件中显示了以下错误,如何解决呢? 在此处输入图片说明

code:- 码:-

using AuthorizationServer.Api.Formats;
using AuthorizationServer.Api.Providers;
using Microsoft.Owin;
using Microsoft.Owin.Security.OAuth;
using Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http.Common;

namespace AuthorizationServer.Api
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            System.Web.Http.HttpConfiguration config = new System.Web.Http.HttpConfiguration();

            // Web API routes
            config.HttpConfigurationExtensions.MapHttpAttributeRoutes();

            ConfigureOAuth(app);

            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

            app.UseWebApi(config);

        }

after referencing the following NuGet: Microsoft ASP.NET Web API 2.2 Core Libraries 引用以下NuGet之后: Microsoft ASP.NET Web API 2.2核心库

在此处输入图片说明

these are my Owin packages i have referenced: 这些是我引用的Owin软件包:

在此处输入图片说明

startup.cs looks like this: startup.cs看起来像这样:

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        HttpConfiguration config = new HttpConfiguration();

        // Web API routes
        config.MapHttpAttributeRoutes();

        // Removed for clarity
        // ConfigureOAuth(app);

        app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);

        app.UseWebApi(config);
    }
}

HttpConfiguration represents a configuration of HttpServer instances. HttpConfiguration表示HttpServer实例的配置。

It is in the 它在

System.Web.Http library System.Web.Http库

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到类型或名称空间名称(缺少使用指令或程序集引用吗?) - Type or namespace name could not be found (missing using directive or assembly reference?) 找不到类型或名称空间名称“ My_Interface_Name”(您是否缺少using指令或程序集引用?) - The type or namespace name 'My_Interface_Name' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或名称空间名称“ CDO”(您是否缺少using指令或程序集引用?) - The type or namespace name 'CDO' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或命名空间名称“TextureImporter”(您是否缺少 using 指令或程序集引用?) - The type or namespace name 'TextureImporter' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或名称空间名称“ BussinessLib”(您是否缺少using指令或程序集引用?) - The type or namespace name 'BussinessLib' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或名称空间名称“ dbConnection”(您是否缺少using指令或程序集引用?) - The type or namespace name 'dbConnection' could not be found (are you missing a using directive or an assembly reference?) 错误 CS0246:找不到类型或命名空间名称“Npgsql”(您是否缺少 using 指令或程序集引用?) - error CS0246: The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或命名空间名称“Dbset&lt;&gt;”(您是否缺少 using 指令或程序集引用?) - The type or namespace name 'Dbset<>' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或命名空间名称“MyApplication”(您是否缺少 using 指令或程序集引用?) - The type or namespace name 'MyApplication' could not be found (are you missing a using directive or an assembly reference?) 找不到类型或名称空间名称“ BasicAckEventHandler”(您是否缺少using指令或程序集引用?) - The type or namespace name 'BasicAckEventHandler' could not be found (are you missing a using directive or an assembly reference?)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM