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


C# IAppBuilder.UseHelloWorld方法代码示例

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


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

示例1: Configuration

        public void Configuration(IAppBuilder app)
        {
            this.ConfigureWebApi(app);

            //app.Use(async (env, next) =>
            //{
            //    foreach (var pair in env.Environment)
            //    {
            //        Console.WriteLine("{0}: {1}", pair.Key, pair.Value.ToString());
            //    }

            //    await next();
            //});


            app.Use(async (env, next) =>
            {
                Console.WriteLine("Requesting: " + env.Request.Path);
                await next();
                Console.WriteLine("Response: " + env.Response.StatusCode);
                Console.WriteLine("---------------------");
            });

            app.UseHelloWorld();
        }
开发者ID:NasC0,项目名称:LeagueComparer,代码行数:25,代码来源:Startup.cs

示例2: Configuration

        public void Configuration(IAppBuilder app)
        {
            //app.Use(async (environment, next) =>
            //{
            //    foreach (var pair in environment.Environment)
            //    {
            //        Console.WriteLine("{0} : {1}", pair.Key, pair.Value);
            //    }
            //    await next();
            //});

            //app.Use(async (environment, next) =>
            //{
            //    Console.WriteLine("Requesting : {0}", environment.Request.Path);
            //    await next();
            //    Console.WriteLine("Response : {0}", environment.Response.StatusCode);
            //});

            ConfigureWebApi(app);

            app.UseHelloWorld();

            //app.Run(ctx =>
            //{
            //    return ctx.Response.WriteAsync("Test");
            //});
            //app.Use<HelloWorldComponent>();
        }
开发者ID:ravishankar54,项目名称:Practice,代码行数:28,代码来源:Program.cs

示例3: Configuration

 public void Configuration(IAppBuilder app)
 {
     app.UseHelloWorld(new HelloWorldOptions
     {
         IncludeTimestamp = true,
         Name = "Earth"
     });
 }
开发者ID:techbuzzz,项目名称:MVC5_Samples,代码行数:8,代码来源:Startup.cs

示例4: Configuration

        public void Configuration(IAppBuilder app)
        {
            app.Use(async (environment, next) => {
                Console.WriteLine("Requesting : {0} ", environment.Request.Path); // request
                await next();
                Console.WriteLine("Response: " + environment.Response.StatusCode); // response
            });

            ConfigureWebApi(app);

            app.UseHelloWorld();
        }
开发者ID:aracen74,项目名称:KatanaIntro,代码行数:12,代码来源:Startup.cs

示例5: Configuration

 public void Configuration(IAppBuilder app)
 {
     //app.Use<HelloWorldComponent>(); ou
     app.UseHelloWorld();
 }
开发者ID:fnalin,项目名称:Demos-Asp.net,代码行数:5,代码来源:Program.cs

示例6: Configuration

        public void Configuration(IAppBuilder app)
        {
            // Use katana specific welcome page
            //app.UseWelcomePage();

            // Takes one param of type IOwinContext and returns a Task - Component
            //app.Run(ctx => { return ctx.Response.WriteAsync("Hello World!"); });

            // Writing anynomous Middleware
            // without creating class and extension method
            app.Use(
                async (env, next) =>
                    {
                        foreach (var pair in env.Environment)
                        {
                            Console.WriteLine("{0}:{1}", pair.Key, pair.Value);
                        }

                        await next();
                    });

            // Another component
            app.Use(
                async (env, next) =>
                    {
                        // All this is request
                        foreach (var pair in env.Environment)
                        {
                            Console.WriteLine("Requesting: " + env.Request.Path);
                        }

                        await next();

                        // All this is response
                        Console.WriteLine("Response: " + env.Response.StatusCode);
                    });

            // Web API stuff
            // If this route is matched no other components are executed since the request matched with the response
            ConfigureWebApi(app);

            // Register new component
            //app.Use<HelloWorldComponent>();

            // Using extension method to call new HelloWorldComponent
            app.UseHelloWorld();
        }
开发者ID:shanekm,项目名称:WebSecurityOverview,代码行数:47,代码来源:Program.cs


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