本文整理汇总了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();
}
示例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>();
}
示例3: Configuration
public void Configuration(IAppBuilder app)
{
app.UseHelloWorld(new HelloWorldOptions
{
IncludeTimestamp = true,
Name = "Earth"
});
}
示例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();
}
示例5: Configuration
public void Configuration(IAppBuilder app)
{
//app.Use<HelloWorldComponent>(); ou
app.UseHelloWorld();
}
示例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();
}