当前位置: 首页>>代码示例>>C#>>正文


C# IAppBuilder.UseHandler方法代码示例

本文整理汇总了C#中IAppBuilder.UseHandler方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseHandler方法的具体用法?C# IAppBuilder.UseHandler怎么用?C# IAppBuilder.UseHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAppBuilder的用法示例。


在下文中一共展示了IAppBuilder.UseHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.UseHandler(async (request, response) => {

                response.ContentType = "text/html";
                await response.WriteAsync("OWIN Hello World!!");
            });
        }
开发者ID:RolandTG,项目名称:OwinSamples,代码行数:8,代码来源:Startup.cs

示例2: Configuration

 public void Configuration(IAppBuilder builder)
 {
     builder.UseHandler((request, response) =>
                            {
                                // write headers first!
                                response.StatusCode = 200;
                                response.Write("Sup");
                            });
 }
开发者ID:Eugene1982,项目名称:NancySignalrOwin,代码行数:9,代码来源:_02_Owin_Extensions.cs

示例3: Configuration

        public void Configuration(IAppBuilder app)
        {
            var logger = app.CreateLogger(GetType());

            app.SetDataProtectionProvider(new SharedSecretDataProtectionProvider(
                "af98j3pf98ja3fdopa32hr !!!! DO NOT USE THIS STRING IN YOUR APP !!!!",
                "AES",
                "HMACSHA256"));

            // example of a filter - writeline each request
            app.UseFilter(req => logger.WriteInformation(string.Format(
                "{0} {1}{2} {3}",
                req.Method,
                req.PathBase,
                req.Path,
                req.QueryString)));

            // example of a handler - all paths reply Hello, Owin!
            app.UseHandler(async (req, res) =>
            {
                res.ContentType = "text/plain";
                await res.WriteAsync("Hello, OWIN!");
            });
        }
开发者ID:RolandTG,项目名称:OwinSamples,代码行数:24,代码来源:Startup.cs

示例4: Configuration

 public void Configuration(IAppBuilder builder)
 {
     builder.UseHandler((request, response) => response.Write(_myService.GetFoo()));
 }
开发者ID:serbrech,项目名称:DublinAltNetOwin,代码行数:4,代码来源:_03_DependencyInjection.cs

示例5: Configuration1

 public void Configuration1(IAppBuilder builder)
 {
     builder.UseHandler((request, response) => response.Write("Sup"));
 }
开发者ID:Eugene1982,项目名称:NancySignalrOwin,代码行数:4,代码来源:_02_Owin_Extensions.cs

示例6: Configuration

 public void Configuration(IAppBuilder builder)
 {
     builder.UseHandler((request, response) => response.StatusCode = 404);
 }
开发者ID:Eugene1982,项目名称:NancySignalrOwin,代码行数:4,代码来源:_04_Testing.cs


注:本文中的IAppBuilder.UseHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。