-
Notifications
You must be signed in to change notification settings - Fork 332
Hello World
These instructions will help you set up an Katana based project and then author and deploy an Katana based app. For additional samples see these docs.
In VS 2015:
From the menu, click: File -> New -> Project...
In the new project dialog, select: Installed -> Templates -> Visual C# -> Web
Choose: ASP.NET Empty Web Application
Install the OWIN System.Web adapter:
- Right-click on the project and select Manage Nuget Packages
- Select Online, and optionally Include Prerelease
- Search for
Microsoft.Owin.Host.SystemWeb
and press Install - Also search for
Microsoft.Owin.Diagnostics
and install it.
Create a Startup class: Right-click on the project and select Add -> Class... Select Installed -> Visual C# -> Code -> Class and name it Startup.cs
Add using Owin;
at the top of the file. Then add the following method in the Startup class:
public void Configuration(IAppBuilder app)
{
app.UseWelcomePage();
}
You can now "F5" to run and should see a simple welcome page running on System.Web (ASP.NET).
Follow the instructions for IIS/Express above to create a web application with a Startup class.
Install the OwinHost
nuget package.
Go to the Project Properties page, Web, Servers, and change the dropdown from IIS Express
to OwinHost
.
Run the app by pressing F5.
Create a console application.
Install the Microsoft.Owin.SelfHost
nuget package.
Add the same Startup class as shown above.
In Program.cs add the using Microsoft.Owin.Hosting;
In Main add:
using (WebApp.Start<Startup>("http://localhost:12345"))
{
Console.WriteLine("Listening on http://localhost:12345");
Console.ReadLine();
}
Run the application by pressing F5, and open the browser to http://localhost:12345
.