17
Our Awards: Deploying ASP.NET and MVC applications to Azure Glyn Darkin, Solutions Architect 18/04/2013

Deploying asp.net and mvc applications to azure

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Deploying asp.net and mvc applications to azure

Our Awards:

Deploying ASP.NET and MVC

applications to Azure

Glyn Darkin, Solutions Architect

18/04/2013

Page 2: Deploying asp.net and mvc applications to azure

What should you be mindful of as a developer if you are

considering Azure as a hosting platform?

Page 3: Deploying asp.net and mvc applications to azure

Outside the scope of this discussion

• Building for the Cloud

• Cloud Service Worker Roles

• Big Data

• Mobile Services

Page 4: Deploying asp.net and mvc applications to azure

Microsoft Azure for ASP.Net

Hyper-V

VMs

Cloud Services

Websites Media Add-Ons

IaaS

PaaS

SaaS

Storage Network

Service Bus

Distributed Cache

Page 5: Deploying asp.net and mvc applications to azure

Azure Website vs. Cloud Service Web Role

Reference MSDN Blog

Comparison Matrix

Feature Web Sites Web Roles

Access to services like Caching, Service Bus, Storage, SQL Azure DatabaseYes Yes

Support for ASP.NET, classic ASP, Node.js, PHPYes Yes

Shared content and configurationYes No

Deploy code with GIT, FTPYes No

Near-instant deploymentYes No

Multiple deployment environments (production and staging)No Yes

Network isolationNo Yes

Remote desktop access to serversNo Yes

Ability to run programs with elevated permissionsNo Yes

Ability to define/execute start-up tasksNo Yes

Ability to use unsupported frameworks or librariesNo Yes

Support for Windows Azure Connect/ Windows Azure NetworkNo Yes

Page 6: Deploying asp.net and mvc applications to azure

Is Azure the only PaaS that can host ASP.NET?

• There will be others

• It’s a race to the bottom

• Our Solutions should be portable

Page 7: Deploying asp.net and mvc applications to azure

Websites

Plain Vanilla Website

• Replicates a Shared Hosting Platform but with elastic scalability

• Can deploy a plain vanilla ASP.NET website

• No SDK dependencies

• No IDE dependencies

• You can deploy your site to other hosting providers

– AWS, AppHarbour, Rackspace

• 10 free sites with the domain http://seotools.azurewebsites.net

• Entity framework is fully supported with migrations

Page 8: Deploying asp.net and mvc applications to azure

Cloud Service

Web Role

• 1 Cloud Service represents a single virtual machine

• Part of a Cloud Solution

• Requires the Azure SDK & tools to be installed

• Uses a VIP to switch between a Staging & Production instance

– Staging DNS creation & resolution can be SLOW

• Your code needs to reference the Azure SDK

– Therefore your product is not portable

• Local development emulator

– Very slow code, test, debug cycle

– Learn to hack using shared resources

– Is not the same as Azure, there are differences so be warned!!!!

• No local disk access

Page 9: Deploying asp.net and mvc applications to azure

Things you need to keep in mind

Part 1

• You need to use the Session State provider for Windows Azure Caching

– TempData uses Session State

• You don’t have write access to the file system

– You will need to store uploaded files in either Blob storage or SQL

• You are running behind a load balancer

– Requests that last longer than 60secs are killed

Page 10: Deploying asp.net and mvc applications to azure

Things to keep in mind

Part 2

• There is no SMTP server in Azure

– User a Service link SendGrid or MailGun

– User Message Bus to send message on premise and email from there

• Logging/Trace output

– Websites: Tracing output is stored against the website on disk & can be accessed via FTP

• Or Streamed into Visual Studio Output Window!!!

– Cloud: Tracing has to be coded & configured & is stored in Table Storage

• It can be queried in Visual Studio

• Configuration

– Websites: Web.config with transformations

– Cloud: ServiceDefinition.csdef and ServiceConfiguration.environment.cscfg

• Images

– Push your images to the Azure CDN

Page 11: Deploying asp.net and mvc applications to azure

Deployment

Website Cloud Service

Direct from TFS Yes Yes

Git, Mercurial, FTP Yes No

MSBuild, Powershell Yes Yes

Visual Studio* Yes Yes

Deployment Pipeline No Yes

* You should never be deploying from Visual Studio

Page 12: Deploying asp.net and mvc applications to azure

Demo

The default MVC website

• Windows Azure Website

– http://version1.azurewebsites.net/

• Windows Azure Cloud Service

– http://version2.cloudapp.net/

Page 13: Deploying asp.net and mvc applications to azure

Comparison of the file structures

Page 14: Deploying asp.net and mvc applications to azure

Windows Azure SQL

http://msdn.microsoft.com/en-us/library/windowsazure/ff394115.aspx

Same Same but different

• Fully managed database environment

• Not all T-SQL supported in Azure

• SQL Management Studio not fully supported

• SQL Server replication not supported

• Backup strategy is a little different – SYNC instead

• Full-Text Search not supported

• Full list of unsupported features

• If you want to scale your database then KISS

• BCP from the command line is fastest way to get all your data in

• MS SQL Server Migration Wizard - http://sqlazuremw.codeplex.com/

Page 15: Deploying asp.net and mvc applications to azure

Conclusion

Recommendations

• Websites uses everything you already know

• CloudServices you have to learn new stuff

• Start with Websites and migrate to a Cloud Service when you need to

• Keep in mind that Azure is a moving target

• Windows Azure SQL requires a very simple approach

– Great for developers, not so much for the SQL DBA

• You can always just spin up a VM for a legacy app

Page 16: Deploying asp.net and mvc applications to azure

Q&A

H H&

Page 17: Deploying asp.net and mvc applications to azure

Links

• Azure Storage Explorer

– Blob, Table, Queue

• CloudBerry Storage Explorer

– Blob with Sync