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)
i am using visual studio community for mac and first error was system.web.http error so i follow the approach listed here:-
MVC 5 on Mono: Could not load file or assembly 'System.Web.Entity' or one of its dependencies
Installed System.Web.Common.Http But Following Error It is Showing In my startup.cs File How to resolve This ?
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
these are my Owin packages i have referenced:
startup.cs looks like this:
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.
It is in the
System.Web.Http library
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.