-
Notifications
You must be signed in to change notification settings - Fork 0
Katana
txgz999 edited this page Jun 13, 2019
·
10 revisions
OWIN (The Open Web Interface for .NET)
Project Katana: Whereas both the OWIN specification and Owin.dll are community owned and community run open source efforts, the Katana project represents the set of OWIN components that, while still open source, are built and released by Microsoft. These components include both infrastructure components, such as hosts and servers, as well as functional components, such as authentication components and bindings to frameworks such as SignalR and ASP.NET Web API.
- In VS2017, create a new ASP.NET Web Application (.NET Framework) project with .NET Framework 4.6.1, choose the Empty project template.
- Install Nuget package Microsoft.Owin.Host.SystemWeb
- Create a StartUp.cs file with the following content:
public class Startup {
public void Configuration(IAppBuilder app) {
app.Run(context => {
context.Response.ContentType = "text/plain";
return context.Response.WriteAsync("Hello World!");
});
}
}- run the application, we should be able to see "Hello World" in the browser.
- In VS2017, create a new ASP.NET Web Application (.NET Framework) project with .NET Framework 4.6.1, choose the Empty project template.
- Install Nuget package Microsoft.Owin.Host.SystemWeb
- Install Nuget package Nancy.Owin
- Create a StartUp.cs file with the following content (similar to asp.net core application, the Configuration method below constructs OWIN pipeline):
public class Startup {
public void Configuration(IAppBuilder app) {
app.UseNancy();
}
}- add a Nancy module (similar to MVC controller) HomeModule.cs:
public class HomeModule: NancyModule {
public HomeModule() {
Get("/", parameters => {
var model = new { title = "Hello World" };
return View["home", model];
});
}
}- add a Nancy view Home.html:
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body>
@Model.title
</body>
</html>- run the application, we should be able to see "Hello World" in the browser.
- Howard Dierking, An Overview of Project Katana
- Praburaj Thiagarajan and Rick Anderson, OWIN Middleware in the IIS integrated pipeline
- Howard Dierking, ASP.NET - Getting Started with the Katana Project