Seeding and Debugging Entity Framework (EF) DBs

In Tom Dykstra’s terrific ASP.NET MVC EF tutorial, the following code is used to seed the student table. var students = new List<Student> { new Student { FirstMidName = "Carson", LastName = "Alexander", EnrollmentDate = DateTime.Parse("2005-09-01") }, new Student { FirstMidName = "Meredith", LastName = "Alonso", EnrollmentDate = DateTime.Parse("2002-09-01") }, new Student { FirstMidName =…


Optimal Azure Restarts

Restarts for Web Roles Updated 17 Jan 2013:  Tracing in OnStop is not supported. An often neglected consideration in Windows Azure is how to handle restarts. It’s important to handle restarts correctly, so you don’t lose data or corrupt your persisted data, and so you can quickly shutdown, restart, and efficiently handle new requests.  Windows…


Top Azure Tips and Best Practices

Tom Dykstra and I have just published an Azure multi-tier tutorial with the complete source. It has many valuable programming tips and best practices you can’t find anywhere else. Learn how to use Windows Azure Storage tables, queues, and blobs in a multi-tier application that has ASP.NET MVC 4 and ASP.NET Web API on the…


Debugging Azure HTTP 500 Errors

By default, Windows Azure Cloud Services Web Role applications, running in Windows Azure or the compute emulator, have the  HTTP Errors <httpErrors> element of the ApplicationHost.config file set to not display detailed error information. What surprised me is that under the compute emulator, IIS-Express doesn’t use the C:Users<user>DocumentsIISExpressconfigapplicationhost.config file, it uses a an ApplicationHost.config file…


Debugging HTTP 500 – Internal server error with the Windows Azure SDK

Update November 2012 – See my new blog entry Debugging Azure HTTP 500 Errors. This blog no longer applies to Azure. Using the current Azure SDK and Visual Studio 2012, you may get a HTTP 500 internal error if there is something wrong with your Web.config file. OK, something went wrong, but what? I actually…


Azure Table Storage

This Azure Table Storage tutorial/sample/walkthrough will get you using Azure Table Storage from ASP.NET MVC in 15 minutes. Tom Dykstra (of MVC/EF fame) and I are working on an Azure email service sample application. All the code was written by Tom.  Our first step was creating a Azure Table Storage account to contain the email…


ASP.NET MVC 4 Mobile Caching Bug Fixed

31 October  2012 Update: The ASP.NET Fall 2012 Update includes the Fixed DisplayModes NuGet package in the new project templates.  You will still need to apply the Fixed DisplayModes NuGet package to projects created before you install the ASP.NET Fall 2012 Update. The RC and RTM versions of ASP.NET MVC 4 had a bug in…


Adding Web Optimization to a Web Pages Site

Adding bundling and minification (B/M) in a Web Pages site follows the same formula ASP.NET MVC and Web Forms use: Declare and register bundles. Consume bundles from within your views.  This blog entry describes the basics of using B/M in a Web Page site. For an overview and more details on B/M, see my tutorial…


InitializeSimpleMembership Attribute and SimpleMembership Exceptions

The InitializeSimpleMembership Attribute ensures that before any membership (login/register) related functionality is run, that the membership database has been created. If the database is not yet created, the code will automatically create one. If the simple membership initialization fails, the Web Application can continue to run requests that don’t require membership. Simple membership initialization failure…


Adding Bundling and Minification to Web Forms

My   B/M tutorial provides a good introduction to benefits of Bundling and Minification. You should read it to become familiar with the bundling and minification. This blog will focus on using B/M with Web Forms, my B/M tutorial focused on ASP.NET MVC. Create a new ASP.NET Web Forms application which targets the .Net 4.5 framework….