VS2012 Getting Started with Owin and Katana
2014-09-04 17:39
369 查看
参考地址:http://www.asp.net/aspnet/overview/owin-and-katana/getting-started-with-owin-and-katana小提示: 该示例必须在.net Framework4.5 框架下才能正确运行。 开发环境最低使用VS2012.1 创建一个空的ASP.NET 程序
2 安装 Add NuGet Packages 管理工具
3 打开Nuget 的控制台名称管理程序,安装 Microsoft.Owin执行命令: install-package Microsoft.Owin.Host.SystemWeb
截图中使用了安装特定版本的命令。4 添加一个启动类。添加一个空的类,命名为startup1 然后加入下面代码.
添加完后解决方案如下:
查看引用,直接添加了几个dll
5 按F5 运行,得到想要的结果了。
6 Self-Host OWIN in a Console Application 通过控制台程序来创建宿主。通过控制台程序,创建一个监听类,监听指定端口传递过来的Http请求,从而实现绕开IIS 发布ASP.NET 应用程序的目的。在解决方案中添加一个控制台程序 取名 MyHttpService.在管理控制台中执行命令:Install-Package Microsoft.Owin.Hosting
2 安装 Add NuGet Packages 管理工具
3 打开Nuget 的控制台名称管理程序,安装 Microsoft.Owin执行命令: install-package Microsoft.Owin.Host.SystemWeb
截图中使用了安装特定版本的命令。4 添加一个启动类。添加一个空的类,命名为startup1 然后加入下面代码.
using System; using System.Threading.Tasks; using Microsoft.Owin; using Owin; [assembly: OwinStartup(typeof(OwinApp.Startup1))] namespace OwinApp { public class Startup1 { public void Configuration(IAppBuilder app) { app.Run(context => { context.Response.ContentType = "text/plain"; return context.Response.WriteAsync("Hello, world."); }); } } }
添加完后解决方案如下:
查看引用,直接添加了几个dll
5 按F5 运行,得到想要的结果了。
6 Self-Host OWIN in a Console Application 通过控制台程序来创建宿主。通过控制台程序,创建一个监听类,监听指定端口传递过来的Http请求,从而实现绕开IIS 发布ASP.NET 应用程序的目的。在解决方案中添加一个控制台程序 取名 MyHttpService.在管理控制台中执行命令:Install-Package Microsoft.Owin.Hosting
相关文章推荐
- Getting Started with OWIN and Katana(Console 代替iis 制作 web服务的简单方案)
- Getting Started with Solr 4.9 and Django haystack
- Getting Started with NHibernate and ASP.NET MVC- CRUD Operations
- Getting started with OpenCL and GPU Computing
- Getting started with SourceTree, Git and git flow
- Getting Started With Ruby and Rails
- IntelliJIDEA Getting+Started+with+Spring+MVC,+Hibernate+and+JSON
- Getting Started with JPA and Eclipse
- Getting Started with AngularJS 1.5 and ES6: part1
- Getting Started with Play 2, Scala, and Squeryl
- Getting started with unit tests in Qt Creator and Catch
- Getting Started With Ruby and Rails
- Getting Started with AngularJS 1.5 and ES6: part2
- Getting Started With Ruby and Rails
- Getting started with SCA and WebLogic
- Getting Started with AngularJS 1.5 and ES6: part 3
- Getting Started with Eclipse and the SWT
- Getting Started with AngularJS 1.5 and ES6: part4
- Getting Started with Mongoose and Node.js – A Sample Comments System | Dev Notes
- Getting Started with Java Management Extensions (JMX): Developing Management and Monitoring Solution