Using NLog with Windows Azure Cloud Services

NLog is an easy to use logging package that can be plugged into virtually any .net application. In my recent experimentation with the Azure platform, I ran into a few hurdles with NLog integration. Azure is intended to allow for horizontal scaling, so you can’t design for a single ‘box’ running your application. While the benefits are many, the drawback to the architecture is that you can just write a file out to a logs directory on your server. But fear not, friends; there is a fairly easy way to get NLog working with Azure using a few simple config settings.
Continue reading

Azure: One week later

After my weekend blitz to get an Azure project in the cloud last week, I’ve learned a few things about the platform that I missed in my previous haste.

SQL Server Management Studio (SSMS) doesn’t do GUI for Azure

I misspoke in my previous article. You can connect without issue to an Azure database but, according to this stack overflow post, you’re basically limited to scripting out your create table statements. ¬†For SQL gurus this might not be a problem, or even preferred. However, for us mortals who still have to look up the syntax to create a cascading delete constraint (included below), it’s not optimal.

ALTER TABLE [dbo].[Childtable] WITH CHECK ADD CONSTRAINT [FK_Childtable_ParentTable] FOREIGN KEY([ParentId])
REFERENCES [dbo].[ParentTable] ([Id])

SQL Server Data Tools (SSDT) are solid


Visual Studio Data Tools in Action

I always hated the built-in data connection functionality of past Microsoft products (VB6 comes to mind…yes, I’m that old). Visual Studio data tools gives you everything you need to build a database properly including scripting out commands and data created using the GUI. I was able to easily setup a database with a full set of constraints without any pain.

There are three main ways to run your application on Azure

  • Websites
  • Cloud Services
  • Virtual Machines

This guide by Microsoft goes in depth and explains it better than I can. I’ve been using websites which are extremely easy to deploy to and should automatically scale up based on load. If I need more control, switching to one of the other methods is not a gargantuan task. Since websites are stateless on Azure, I will be experimenting with writing error logs since you don’t have persistent file storage. Stay tuned…