crafting hot apps for mobile & web

firelight apps begins

April 29, 2013
I have a spare 15 minutes while I deploy another web role to Azure so why not write up a brief entry about firelight apps.

Who am I

Steve Pascoe. I'm passionate about what I do, always keen to blaze new trails in development and desire to make exciting features that delight users. I have solid asp.net experience, enjoy the zippyness of node.js and django is great for just getting things done.

More about me

LinkedIn

Why firelight

Because when I'm not coding ... I'm coding. I'm one of those lucky people who get paid to do their hobby full-time. And 9-5 monday-friday just isn't enough.

Azure Startup Scripts and how the heck you create them

April 29, 2013
I spoke to an MS contact the other day asking me how I've been going setting up Azure. It seems 90% of my issues all kept coming back to correctly creating / configuring a startup script.  

Creating the script

The script is basically a text file saved with a .cmd extension. I called mine LaunchOnStartup.cmd and inside it contains my scripts to be run. Eg, powershell -Command "Set-ExecutionPolicy Unrestricted" powershell new-eventlog -logname 'Application' -Source 'MyAppDB' powershell new-eventlog -logname 'Application' -Source 'MyAppService' See my post on Azure Event Viewer EventLog ... Logging for an important tip on setting osFamily Once last thing to remember is to select your file in the Visual Studio project, properties. And select the "Copy to Output Directory" = "Copy Always".  

Text format ANSI

Once gotcha I faced was the script file's format. I created the file in visual studio, saved ... all good. But guess what, Azure server never starts. After running the script manually on the server in command prompt (knowing my powershell script wouldn't work but still I was desperate) I noticed two funky strange characters at the beginning of the script. They didn't show up in notepad but certainly did in command prompt. As a result .... "Bad command or filename" (well something similar). The solution I eventually arrived at was to do my editing of the script. Then close it in visual studio. Open it in notepad, save as. Overwrite the same file but ensure the text format is ANSI. Once this was done my script ran fine in the command prompt and what do you know, ran fine in Azure also!  

Place the reference to the file at the top of your ServiceDefinition.csdef

I should test this again as it was bundled in with all the other issues I was facing around startup scripts. But certainly placing it at the top of the file just below the <WebRole name="MyApp" vmsize="Small"> <Startup> <Task commandLine="LaunchOnStartup.cmd" executionContext="elevated" taskType="simple"> </Task> </Startup> <Sites> .....   I have a few more posts on working with Azure so why not take a quick moment to browse the tag cloud.

Azure 32 bit dll running in IIS Web Role

April 29, 2013
I spoke to an MS contact the other day asking me how I've been going setting up Azure. It seems 90% of my issues all kept coming back to correctly creating / configuring a startup script. Here is the magic command to set by default, all App Pools in IIS to allow 32 bit dlls to run. %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.enable32BitAppOnWin64:true For an example of where to put this file see my other post Azure Startup Scripts and how the heck you create them.

SQL Azure copy database

April 29, 2013
SQL Azure is great, the implications are amazing. I can have a local app but its database is in the cloud. If dipping your toe into the cloud is your thing then this is perfect. However I did run in to an issue at step 1 ... I had my database (developed locally with some data preloaded), how do I get it up into SQL Azure? I attempted a few different methods but honestly ALL you need to know is: http://sqlazuremw.codeplex.com I cannot recommend it highly enough. IT JUST WORKS! So if you are looking to migrate data from one server to SQL Azure then this tool will do it and do it well!

Mac App running on every desktop space

April 29, 2013
I cannot live without at least 2 monitors. You all know the benefits it has to productivity. On the Mac, Lion introduced desktops. You can get to them and create new ones from Mission Control. You can also switch to them by 3 finger swiping (or 2 finger swiping with Magic Mouse). I like to have my comms (ie, Skype) on my left monitor. That way when I switch desktops I know I always have Skype visible. The way I achieve this is by right clicking the icon on the Dock -> "Options" -> Check the tick against "All Desktops".

Azure Event Viewer EventLog ... Logging

April 29, 2013
I spoke to an MS contact the other day asking me how I've been going setting up Azure. It seems 90% of my issues all kept coming back to correctly creating / configuring a startup script. After recently diving in to Windows Azure with the task of migrating an existing app, getting the EventLog up and ... logging was very important. Yes we could have gone down the almost overwhelming path of "Microsoft Windows Azure Diagnostic Services Application Foundation Platform Flux Capacitor 2012". But the existing codebase already heavily relied on the Event Viewer for logging information. So in an effort to get things up and running in Azure the publish button was pushed. Uh huh you guessed it, machine instance "busy". And never starts. Turns out you cannot create your own Event Log Sources once a machine instance has been created. Bummer! All is not lost however because it turns out you DO have a window of opportunity in which to create new event log sources. The Startup Script. So as an example here's what I have in my startup script. powershell -Command "Set-ExecutionPolicy Unrestricted" powershell new-eventlog -logname 'Application' -Source 'MyAppDB' powershell new-eventlog -logname 'Application' -Source 'MyAppService' Now for something that will save you DAYS! Make sure you set the osFamily value in your ServiceConvifguration.Cloud.cscfg to 2. Leaving it at its default will create the server in Azure as a win 2008 SP2 ... which runs powershell 1.0. By setting the value to 2 this will create the server in Azure as win 2008 R2 ... which runs powershell 2.0! So what? ... the command new-eventlog was introduced in powershell 2.0. So remember, osFamily="2" For an example of where to put this file see my other post Azure Startup Scripts and how the heck you create them.

© 2013 firelight apps :: Sydney, Australia :: apps@firelightapps.com