Bhushan Gupta

Bhushan Gupta

  • 1.3k
  • 383
  • 3.6k

WEB API Self Hosting Error

Jun 25 2017 4:42 AM
 
 
 
Error coming: {"The following errors occurred while attempting to load the app.\r\n - No 'Configuration' method was found in class 'WebPIHTTPServices.StartUp, WebAPIHTTPServices, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":""}
 
I have created a console application for web api self hosting through owin and added NuGet package Microsoft.OWIN related..
 
 
First class is this: 
 
using Owin;
using System.Web.Http;
namespace WebAPIHTTPServices
{
public class StartUp
{
public void Configration(IAppBuilder app)
{
var config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
app.UseWebApi(config);
}
}
}
 
 ------------------------------
using System;
using Microsoft.Owin.Hosting;
namespace WebAPIHTTPServices
{
public class Program
{
static void Main(string[] args)
{
using (WebApp.Start<StartUp>("http://localhost:12345"))
{
Console.WriteLine("Web Server is running");
Console.WriteLine("For Quit");
Console.Read();
}
}
 
Advance thanks 
 
 

Attachment: Console.rar

Answers (1)