Upload
shahriar-hossain
View
370
Download
0
Embed Size (px)
Citation preview
Welcome to ASP.NET Core in
Azure
Shahriar Hossain
Microsoft MVP
Trainer
Author, Microsoft Silverlight for Windows Phone
Tech blogger
Microsoft Technical Community Speaker
ASP.NET Core & Azure
Agenda Introducing lightweight ASP.NET Core • Overview• Getting started• Middleware• Deployment in Azure
ASP.NET Core
A new open-source and cross-platform framework for building modern cloud-based Web applications using .NET
MVC Web APIWeb Pages
Razor
HTML Helpers HTML Helpers
Controllers Controllers
Actions Actions
Filters Filters
Model binding Model binding
DI DI
ASP.NET framework
MVC + Web API + Web Pages =
ASP.NET Core MVC
ASP.NET Core 1.0 – Key Values
Choose your Editors and Tools
Open Source with Contributions Cross-PlatformOSS
Seamless transition from on-premises to cloud
Faster Development CycleTotally Modular
Fast
ASP.NET Core Pipeline
ResponseRequest Middleware
ASP.NET Core Middleware
Standard Middlewarepublic class Startup{ public void Configure(IApplicationBuilder app) { app.UseStaticFiles(); app.UseWelcomePage(); }}
• Static files• Routing• Error Handling• MVC
Built-In Middlewareapp.UseStaticFiles();
app.UseRouter(routes);
app.UseExceptionHandler("/Home/Error");app.UseMvc(routes =>{ routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}");});
Middlewareapp.Use(next =>
{return async ctx =>{
await ctx.Response.WriteAsync("Hello from USE");await next(ctx);
};});
app.Use(async (ctx, next) =>{
await ctx.Response.WriteAsync("Hello from USE");await next();
});
app.Run(async ctx => { await ctx.Response.WriteAsync(“Hello from Run"); });
Custom Middlewarepublic class MyMiddleware{
private readonly RequestDelegate _next;
public MyMiddleware(RequestDelegate next){
_next = next;}
public async Task Invoke(HttpContext context){
await context.Response.WriteAsync("Hello!");await _next(context);
}}
DEMO
Community Group• Microsoft Azure Bangladesh• group: www.facebook.com/groups/microsoft.azure.bd• fan page: fb.com/microsoft.azure.bd• Asp.Net MVC - Bangladesh• www.facebook.com/groups/asp.net.mvc.bd• NerdCatsSchool • www.facebook.com/groups/NerdCatsSchool
Shahriar Hossain
Find me athttp://facebook.com/Shahriar.cse
Personal Blog
Find me athttp://bd.linkedin.com/in/shahriarhossain
Find amazing .Net stuffs at http://LearnWithShahriar.wordpress.com
Thank You