本文整理汇总了C#中IApplicationBuilder.UseOwin方法的典型用法代码示例。如果您正苦于以下问题:C# IApplicationBuilder.UseOwin方法的具体用法?C# IApplicationBuilder.UseOwin怎么用?C# IApplicationBuilder.UseOwin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApplicationBuilder
的用法示例。
在下文中一共展示了IApplicationBuilder.UseOwin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(IApplicationBuilder app)
{
app.UseOwin(addToPiepline =>
{
addToPiepline(next =>
{
return async env =>
{
var accept = env["websocket.Accept"] as WebSocketAccept;
if (accept == null)
{
// Not a websocket request
await next(env);
}
else
{
accept(null, WebSocketEcho);
}
};
});
});
app.Run(async context =>
{
context.Response.ContentType = "text/plain";
await context.Response.WriteAsync("Not a WebSocket");
});
}
示例2: Configure
public void Configure(IApplicationBuilder app)
{
app.UseOwin(x =>
x.UseNancy(opt =>
opt.Bootstrapper = new NancyBootstrapper(Config)));
Console.WriteLine("Nancy now listening - " + "" + ". Press ctrl-c to stop");
}
示例3: Configure
public void Configure(IApplicationBuilder app)
{
app.UseOwin(pipeline =>
{
pipeline(next => OwinHello);
});
}
示例4: Configure
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseStatusCodePages();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action}/{id?}",
defaults: new {controller = "Home", action = "Index"});
});
app.UseOwin(addToPipeline =>
{
addToPipeline(next =>
{
var builder = new AppBuilder();
var hubConfig = new HubConfiguration { EnableDetailedErrors = true };
builder.MapSignalR(hubConfig);
var appFunc = builder.Build(typeof(Func<IDictionary<string, object>, Task>)) as Func<IDictionary<string, object>, Task>;
return appFunc;
});
});
}
示例5: Configure
public void Configure(IApplicationBuilder app)
{
// Make Nancy use bootstrapper with pre-built container.
app.UseOwin(owin =>
owin.UseNancy(options =>
options.Bootstrapper = new Bootstrapper(Container)));
}
示例6: Configure
public void Configure(IApplicationBuilder app)
{
app.Use( (ctx,next) => {
WriteLine($"[{ctx.Request.Method}] {ctx.Request.Path}");
return next();
});
app.UseOwin(x => x.UseNancy());
}
示例7: Configure
public void Configure(IApplicationBuilder app)
{
var config = this.Configuration;
var appConfig = new AppConfiguration();
ConfigurationBinder.Bind(config, appConfig);
app.UseOwin(x => x.UseNancy(opt => opt.Bootstrapper = new DemoBootstrapper(appConfig)));
}
示例8: Configure
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.UseOwin(pipeline =>
{
pipeline.UseNancy(options => options.Bootstrapper = new MyNancyBootstrapper());
});
}
示例9: Configure
public void Configure(IApplicationBuilder app)
{
app.UseOwin(addToPiepline =>
{
addToPiepline(next =>
{
return Invoke;
});
});
}
示例10: Configure
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseOwin(x => x.UseNancy());
}
示例11: Configure
public void Configure(IApplicationBuilder app)
{
app.Use((context, next) =>
{
context.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
context.Response.Headers.Add("Access-Control-Allow-Headers", new[] { "*" });
context.Response.Headers.Add("Access-Control-Allow-Methods", new[] { "*" });
return next();
});
app.UseOwin(x => x.UseNancy());
}
示例12: Configure
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.UseOwin(buildFunc =>
{
buildFunc(next => env =>
{
System.Console.WriteLine("Got Request");
return next(env);
});
buildFunc.UseNancy(options => options.Bootstrapper = new MyNancyBootstrapper());
});
}
示例13: Configure
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
var runtime = new Runtime();
runtime.RegisterResource(new FooResource());
app.UseOwin(builder => builder.UseTurquoise(runtime));
//app.UseServer();
// app.UseIISPlatformHandler();
// app.Run(async (context) =>
// {
// await context.Response.WriteAsync("Hello World!");
// });
}
示例14: Configure
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseOwin(addToPiepline =>
{
addToPiepline(next =>
{
var middleware = new DebugMiddleware(next);
return middleware.Invoke;
});
});
// Configure the HTTP request pipeline.
app.UseStaticFiles();
// Add MVC to the request pipeline.
app.UseMvc();
// Add the following route for porting Web API 2 controllers.
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
}
示例15: Configure
public void Configure(IApplicationBuilder app)
{
var factory = app.ApplicationServices.GetRequiredService<ILoggerFactory>();
factory.AddConsole();
app.UseCookieAuthentication(options => {
options.AutomaticAuthentication = true;
options.AuthenticationScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.LoginPath = new PathString("/signin");
});
app.UseTwitterAuthentication( configureOptions =>
{
configureOptions.ConsumerKey = TWITTERCONSUMERKEY;
configureOptions.ConsumerSecret = TWITTERSECRET;
configureOptions.AutomaticAuthentication = true;
configureOptions.AuthenticationScheme = "Twitter";
});
app.UseOwin(x => x.UseNancy());
}