Skip to content →

Month: November 2014

How to get a txt/sms message when an Azure service goes down

Over the last few weeks a number of services I have deployed to Azure have experienced difficulty. Luckily I have pretty good monitoring on my apps that notified me of the problem.

What I really wanted was a way to correlate between my apps having issues and any known problems with Azure. Luckily Azure has a number of excellent status feeds that are available for monitoring their services. With a little help from http://ifttt.com we can set up an alerting system so that you can get a txt/sms message when the monitoring feed changes.

Here are my shared recipes so that you set them up for yourselves

https://ifttt.com/recipes/224263-azure-website-monitoring

https://ifttt.com/recipes/224264-azure-sql-database-monitoring

If you use different services then you need to get the feed url for each service and add them into your recipe. The full status board below has all the different services listed, if you click on the orange feed icon this will take you to the feed. Just copy the url from your browser into the url box in the ifttt recipe.

http://azure.microsoft.com/en-us/status/

Technorati Tags:
Leave a Comment

ASP.NET vNext – Packing and Publishin

These are my notes from the ASP.NET vNext Community Standup

Packing and Publishing

Packing and Publishing is the process of taking the source and static files as they are represented in my source tree and staging them into a folder structure ready to xcopy onto a server.

The underlying process uses the KPM command line tool, which has a number of switches for options to control the output.

There are levels out publishing:

  1. Move the files and folders and pull in the nuget packages ready for deployment
  2. Same as above, but compile all the *.cs files into a dll

The KRE runtime can now run code without it having to be compiled first.  This enables deployment to be a simple xcopy of the source files. If you want to compile all the source files up front then rather than compiling them to a traditional bin folder they will get compiled into a nuget package and get deployed into the packages folder. This is an important point as it means that all executable C# code is modular and managed at the package level.

You starting folder structure will look similar to the below tree structure, this is the structure that would get checked-in to your source control provider.

  • $/
    • src
      • MyWebApp
        • project.json
        • files.cs
        • wwwroot
          • static files

All external nuget packages would be references under the dependencies node of your project.json file, however your packages are pulled down from the remote repository and stored in a local cache in your user profile. When your application runs the KRE runtime will probe for the packages and use the cached versions.

Packing the solution using kpm and the pack command will generate an xcopyable deployable.

kpm pack –out output file path

Output directory structure

  • output file path
    •  wwwroot
      • web.config
      • static files
    • approot
      • packages
        • nuget packages
      • src
        • project.json
        • x.cs

This separation of source code and static files means that code can never be served.

IIS or Kestrel anchors to the wwwroot folder.

If your decided to compile your application when you package the output folder structure would look similar to the below:

  • output file path
    •  wwwroot
      • web.config
      • static files
    • approot
      • packages
        • nuget packages
        • MyAppPackage

The MyAppPackage represents your source code compiled to a nuget package, the package process all pulls all cached versions of the dependent nuget packages so that they can be xcopy deployed.

Using wild cards in version numbers enables automatic updates to dependencies without having to reupdate

KRE – is the new runtime, this can be included in the packages folder if the CLR is not already installed on the target machine.

CLR can be either remote deployed onto a server and shared, or deployed locally within the packages folder which will take precedence.

F5 != kpm pack

The Visual Studio publish UI uses this underlying command.

 

 

Leave a Comment

ASP.NET vNext – Entity Framework 7 Design (Notes)

My notes from the ASP.NET Community Standup 4

Main goal of ASP.NET is to shink down the memory footprint of a Request.

Data access is a first class tenant of web applications, therefore Entity Framework is becoming a first class tenant of ASP.NET.

EF is becoming portable and is trying to provide a single consistent programming model for all data access, on the server, on the desktop, tablet of mobile.

EF 7, is also a complete rewrite. To make EF lighter the underlying EDMX has been removed, making it more modular and light weight.  Little code is being moved forward, the focus is more on the API, designs and conventions that people have adopted.

EF 7 will be a PCL Nuget package, with the objective that it can run on Mono, Xamarin etc.

Providers will include Redis, Azure Table Storage.

No Model First, no designer. Only Code first using annotations and fluent api, however it will still include reverse engineering to generate code from an existing database table.

EF7 is not recommended for a complex datamodel, its focus is on providing a common abstraction over simple datamodels.

Indexes will now become a first class citizen of the mapping infrastructure so that they can be managed via code first. Providers can use this metadata to generate their own interpretation of an index based on their store.

Providers are created for each type of data store. There are some helpers for providers creating Linq. There is some capabilities for projecting those Linq expressions in memory when the underlying data store does not support Linq.

EF7

Shipping Providers

  • MS SQL Server
  • SQL Lite
  • Azure Table Storage
  • Redis Provider

Heavy focus on performance and memory management, including batching, change tracking and the output sql generation.

If you want the EDMX and designer you should use EF6 which will be fully supported for the foreseeable future.

Leave a Comment

ASP.NET vNext – Razor, Directives and Tag Helpers (Notes)

These are my notes from the ASP.NET vNext Community Standardup 3

 

Razor Views now support async processing out of the box.

This is particularly important for ASP.NET webpages or using Razor outside the normal MVC lifecycle.

Razor now supports incremental flushing, so that HTML can be streamed to the browser. This is enabled using a new “@await FlushAsync()” razor command that can be called within the page.

 

Dependency injection is now plumbed into Razor.

@inject

@inject IFoo Foo

Components can now be injected via IoC into a View

 

The default helpers have been removed from the base class and are now injected using the Injection mechanism. This means that you can expand your own Helpers

 

Use _ViewStart pages

Now _ViewStart supports directives, so that we can use the @inject directive to set global properties, _ViewStart files can be cascaded and nested.

Pre compilation is still around and will be turned on by default.

 

Available directives

@inject IFoo Foo

@using My.Comapny.Namespace

@inherits points to the base class

@model use this model across the lifes

 

Templating

Model C# class

Validation based on Attributes on Model

Razor template to generate AngularJS Template, and then client side AngularJS processes template

 

Tag Helpers

Provides a solution to support better HTML manipulation similar to how AngularJS manipulate HTML

Example

<input for=”FirstName” class=”form-field” />

<tag-cloud count=”2″ />

This extension improves the authoring of Razor files and provides better intellisence.

This does not enable a server side dom, you can access the view string, but you would have to manipulate this yourself, however this is not recommended as it limits the buffering and thus speed of the page.

Intent of feature is not to become server side DOM but to improve HTML helpers with HTML style syntax.

 

 

Leave a Comment