I'm following this guide to self host owin in a console application. My problem is, after creating a project and adding all the nugets, when I copy and paste the program code I get "The type or namespace name 'WriteLine' does not exist in the namespace 'Console'" Anyone knows what's causing the issue? I'm targeting framework 4.7.2.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Console
{
class Program
{
static void Main(string[] args)
{
using (Microsoft.Owin.Hosting.WebApp.Start<Startup1>("http://localhost:9000"))
{
Console.WriteLine("Press [enter] to quit...");
Console.ReadLine();
}
}
}
}
CodePudding user response:
Just change this namespace Console
your app has Console namespace it shouldn't be like that
Example
namespace ChangeThisNameToAnotherOne
{
class Program
{
static void Main(string[] args)
{
using (Microsoft.Owin.Hosting.WebApp.Start<Startup1>("http://localhost:9000"))
{
Console.WriteLine("Press [enter] to quit...");
Console.ReadLine();
}
}
}
}