Azure Deployment Issues
Today has been “one of these days” where nothing was going smooth….
I have been working as a consultant for some time on a back-end project that was to run both in “self-hosted mode” (aka Windows Service) and in Windows Azure.
We had adjusted some minor details in an OData endpoint (aka WCF Data Service), and tested it “in self-hosted mode”. When I was done with the testing I redeployed the solution to Azure.
And as soon as I accessed my service, the server crashed with a 500-Internal Server error. I tested some other services, but they was working just fine.
Based on earlier experiences I guessed that some DLL’s was missing and since there was several people in the project, not all focusing in Azure, I was guessing some DLL’s had lost it “copy local=yes” attribute.
Since the solution is quite large, I had to use some time to verify all this – but I didn’t find anything special.
I added “copy local=yes” some DLL’s that I was pretty sure was not in Azure, and redeployed to no help.
I even used the nice service http://gacviewer.cloudapp.net/ to help me locate bad configuration to no help.
And the error message from WCF was not very helpful. Internal server error.. yeah right.. See server logs, yeah right – nothing in Event log or IIS log.
After some research, I found an article describing how to enable debugging output from WCF: http://blogs.msdn.com/b/phaniraj/archive/2008/06/18/debugging-ado-net-data-services.aspx ‘
- Set a tag in the source code or via enable Config, I prefered the tag.
- [System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
- Set UseVerboseErrors to true in the ServiceConfiguration
Now the WCF service gave me something more than 500-Internal Server Error. “The server encountered an error processing the request. The exception message is ‘Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.’” and the stack trace.
I noticed something odd in the stack trace, a mention of the function “SyncInvokeProcessRequestForMessage”. This was helpful, as I knew someone has modified the Sync logic in the back-end system.
Some more research, and I found this article “How to: Deploy Sync Framework to Windows Azure” – http://msdn.microsoft.com/en-us/library/ff928660(v=sql.110).aspx.
As it turns out, you have to put on your Azure Black Belt to actual get your deployment to Work in Azure when Sync is involved.
By using the recipe in the MSDN article I was able to get the solution to work, but Microsoft – come on – this needs to be much easier!!
Back from the dead – the dark side of Windows XP Activation
I have an old Compaq laptop running windows XP complete with a develeopment environment for an important customer. The laptop has a complete development environment for some old code (read: Visual Studio 2005, VB6, Sybase, including valid licenses for 3 party components).
Since the machine is critical in the maintenance of the old code I try to take good care of it. The performance is not great, but I manage (1,6Ghz cpu, 1 GB RAM, 60 GB disk).
But the HW is getting old – and I am starting to worry about that the laptop might one day not wake up when I try to turn it on, so I want to virtualize the OS and the programs – so I can move the virtualized PC to some HW with better performance, and with the possibility to easily back up the complete virtual pc.
So I embarked on the journey…
To virtualize a PC you can use the free tool Disk2VHD from Sysinternals. Disk2vhd is a utility that creates VHD (Virtual Hard Disk – Microsoft’s Virtual Machine disk format) versions of physical disks for use in Microsoft Virtual PC or Microsoft Hyper-V virtual machines (VMs).
After a relatively short time I had my VHD which I tried to boot up in Virtual PC. Well, it actually booted on the new HW but after logging in the Windows Activation kicked in, and asked for a license key. No problem, I thought, I had the license key ready – it was on the sticker on the laptop. Windows promptly said that the license code was not valid.
Some research and it turns out that the license code that is labeled on PC’s that are OEM manufactured (IBM, DELL, HP, COMPAQ,++) isn’t valid if you try to activate the OS with Microsoft. Windows XP OEM edition actually reads areas of the BIOS to detect if the OS is running on the OEM PC that it is made for, and if not, it decides it is not activated and asks for a license code. If the BIOS is valid, “Pre Activation” as it is called kicks in and activates windows without talking to Microsoft.
The catch here is that whatever (it seems..) license code you give to the OEM version of Windows, it just says it is not valid. (If anyone knows different, please let me know).
Some more research, and I found an article describing “How to Change Windows XP Version Between Retail, OEM and Volume License Channel“. Perfect!
In short: To upgrade from OEM to RETAIL version of Windows XP you could boot from an Windows XP CD with the RETAIL edition and “Repair” the OS. After doing that, windows would ask for a license key for the RETAIL edition of Windows XP. Luckily I had laying some old Windows XP cd’s and some valid license codes.
Then I did something I really shouldn’t have done – I followed this advice and actually did this on my production laptop (after trying on the VHD image with no luck). To my defense it was starting to get really late in the evening.
After “repairing” the OEM version to the RETAIL version, Windows XP asked (as expected) for the License Code. I punched in the code, and pushed “Next”. Nothing happend! Reboot, try again, Nothing. Reboot, try again, wait until next morning, nothing..
So now I had my old laptop in a none functional state, and I have a deadling on a project where I need to use the tools inside the laptop. Where is the “regret” button when you really need it…
Ok, some more research, and it turns out that one possible way to make Windows NOT ask for the license code is to “repair” it back to OEM. The problem is that I do not have the OEM disks for Windows XP (I don’t know if they really exists outside the OEM factory).
It turns out that there are OEM CD’s available if you look at the right places (You probably guessed torrent, which is pretty correct). After “finding” the Windows XP SP2 HP OEM cd, I was realy hoping this might get my Windows back into the original state.
Well, after booting the OEM CD, “repairing” my Windows – I am now able to boot up my laptop and log in. Relief is not a strong enough not word for what I was feeling now. According to the dictionary it is close “relief – a feeling of cheerfulness or optimism that follows the removal of anxiety, pain, or distress”
The Silence of the Circuit Board..
During my NNUG presentation on .NETMF I had planned for several demos. One of the demos was playing MP3 files through the VS1054 Sound Chip integrated on the ChipworkX Dev Kit.
But things didn’t go as planned, the code deployed and “everything” worked – except there was no sound. I then blamed the “bug” on the unplanned code change I did to set the output volume to max.
Since the last weeks has been pretty busy I didn’t have the time to immediately try to debug the reason, but during this week I had to do some development on the kit, which included network traffic.
And – unexpectedly – the network socket’s didn’t work. First I did some review of the code and the network configuration, before I realized that this must be something with my hardware.
Can it be that some static-electricity had damaged my Dev Kit ?
I know you can’t physically see such damage, but I started to inspect the Dev Kit. And after some initial inspections on the top layer of the PCB I turned the Dev Kit around to check its back side.
And here I found the problem.
On the Backside of the Dev Kit the actual ChipworkX module is mounted in a SO-DIMM connector, not welded to the PCB.
And in my case, the module was askew on one side- some pins where connected, but many pins was not connected. How the module actually was able to work in this condition I do not know.
I inserted the module back in its connector, and now both my network and sound was working!
Now I remembered discussing ChipworkX shortcomings with GHI, where they told me that this module differed from the other modules in two ways:
- The module could detach itself from the connector if the devices is subjected to shaking
- The module is NOT designed for cold weather (only from 0 to +70 Celsius)
So in future projects, make sure that the module is welded to the PCB if you are going to shake it :-)
To Anaheim we go.. #bldwin
So I’m in Anaheim for the Microsoft BuildWindows conference. Its contents are so super-secret that even the day before the opening of the conference the Agenda is ”empty”, it just says Sessions.
Needless to say I am super excited and I can’t wait for the keynote for tomorrow morning.
If you are not here – or if you are here and want to stay updated – check out the Article “How and where you can watch the Build Windows event keynote and be part of the excitement” which as lot of extra information including how to see the keynote streamed live. And make sure you follow the twitter hastag #BldWin
If you are interrested in Windows8, Microsoft has created a blog called “Building Windows 8 - An inside look from the Windows engineering team”. It has already some exciting blog posts.
There are a lot of rumors and predictions, one of my favorite rumor is that we may get a Windows8 table to play with. Fingers crossed.
This blog by Robert McLaws has some interresting predictions: http://www.windows-now.com/blogs/robert/my-predictions-for-this-weeks-pdc-2011-oops-i-mean-build.aspx
My SQL Azure presentation
Last week I was invited by Microsoft to do a presentation on SQL Azure at TechDays here in Norway.

As always I like to be well prepared, so building the slides and doing a complete background research – in case of unexpected questions – was neccesary. This was fun and I learned quite a few new things doing this
I did actually get a “difficult” question on what the difference between “Sharding” and “Azure Federation” was, and as this was covered during my research I was happy to answer.
My presentation was just after the BI guru Rafal Lukawiecki (which has 6 “Best Speaker” from TechEd), so it was a bit like jumping after Wirkola, but Rafael was very kind and helped me to get rigged before my presentation and even helped me calm my nerves.
Feedback from the presentation was nice, thanks to all of you that voted green and yellow. Luckily, no red lables
The presentation slides are out now, you can download the presentations from SkyDrive or view it directly here.
Newsflash on Sync Framework V4
During my presentaion I spoke about several sync technologies, including Sync Framework V4 that Microsoft had decided to drop support for, but was going to make the source available.
Today Rob Tiffany announced that the Sync Framework is now open source. Check out his blog for more details: http://robtiffany.com/sync-framework/sync-framework-v4-is-now-open-source-and-ready-to-connect-any-device-to-sql-server-and-sql-azure
The bits are hosted by MSDN at http://code.msdn.microsoft.com/Sync-Framework-Toolkit-4dc10f0e
My .NET Micro Framework presentation
Last week I did a presentation called “Powering your embedded devices with Micro Framework” at Norwegian .NET User Group (NNUG) in Oslo.
My presentation was the second presentation this evening where the agenda was “.NET outside Windows”
Before the presentation I got some help from Colin Miller (Product Unit Manager .NET Micro Framework, Microsoft) with some of my slides and statistics – thank you Colin!
In addition a HUGE thanks goes to Gus Issa and Joe Issa at GHI Electronics – for their generosity. I got many FEZ Panda from them– that we gave to the lucky winners after the presentation.
Since the presentation, NET MF version 4.2 RC2 has been released and the final 4.2 is just around the
corner. For more information check out http://blogs.msdn.com/b/netmfteam/archive/2011/08/30/netmf-version-4-2-release-candidate-2.aspx
The Demo Ghost
During the presentation I was to give some demo’s. But because I had been more busy then anticipated, a few days before the presentation my demo was still not finished.
I had planned to demo a temperature and light sensor network with several devices communication using ZigBee, but the amount of work implementing the ZigBee stack was bigger than anticipated.
Then I discovered that the week before at NNUG in Stavanger Kristian Hellang had done a presentation about .NET MF, so I looked into his stuff and borrowed the idea of the MP3 player.
I already had the drivers for the VS1054 sound chip that was available on the ChipworkX DevKit from the the Open Source project Pyxis 2, all I needed to do was to add logic that scanned for MP3 files on a USB stick.
Code implemented and tested a few days before the presentation, and everything looked good. But during the presentation I did one thing one should never do – I changed the code – just a bit – and that made the whole demo collapse.
The line of code I changed was inside the VS1054 drivers from the Pyxis2 source code, during Initalize. One statement, I removed the comment in front of this: //Command_Write(SCI_VOL, 0); // highest volume
I was hoping to get the highest volume out of the speakers, but that made my player go completely silent. Even loading the complete demo project – that had worked – days before, didnt work. No sound.
I have not had the time - yet – to get around to try to “undo” the changes this command did inside the VS1054 chip.
So I was unable to play my carefully selected music, “What Have You Done” and “Stand My Ground” which you now can listen to directly on You Tube
Deploying a Web Site to Azure that uses the embedded ReportViewer control in local processing mode
Background
“Local processing mode” means that the ReportViewer is not connected to a Reporting Server to do the processing but requires the developer to generat the DataSet(s) up front, and that the ReportViewer control is handed the DataSet(s) together with the report layout (the RDLC file) so that it can render the report.
According to MSDN documenation ”How to: Use ReportViewer in a Web Site Hosted in Windows Azure” this is not supported. It states “Note: ReportViewer configured in local processing mode is not supported in Windows Azure .”
I don’t know the reason for this statement – but the positive thing is that it doesn’t say “Note: ReportViewer configured in local processing mode does not work Windows Azure”, it just says it is “not supported”.
To get the ReportViewer to work you need to get the neccesary DLL files that the ReportViewer control uses copied to the bin folder during build, so that deploying to Azure actually brings in the neccesary DLL.
(Remember that the Azure servers do only have the .NET runtime and the Azure DLLs installed so you need to bring in the DLL’s you are using)
What you need
In remote processing mode, the ReportViewer control uses the following assemblies:
- Microsoft.ReportViewer.WebForms.dll Contains the ReportViewer code, which you need to use ReportViewer in your page. A reference for this assembly is added to your project when you drop a ReportViewer control onto an ASP.NET page in your project.
- Microsoft.ReportViewer.Common.dll Contains classes used by the ReportViewer control at run time. It is not automatically added to your project
In addition you will need these two DLL’s for doing local processing
- Microsoft.ReportViewer.ProcessingObjectModel.dll -
- Microsoft.ReportViewer.DataVisualization.dll -
I even had to throw in an “unrelated” DLL to get things to work – I am not 100% sure if you need it, but I had to add it to get it to work.
- Microsoft.Web.Infrastructure -
How to get DLL files out of the GAC
For the DLL’s in the GAC you need to copy them out from the GAC and to a folder inside your project (so that you can add it to SourceControl and not break the compile or create trouble for other developers in the team)
The GAC is using this folder on your PC: %windir%\assembly\GAC_MSIL
So the DLL Microsoft.ReportViewer.ProcessingObjectModel is stored in the folder C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel. Actually there is a subfolder for each version of the DLL. For the VS2010 version make sure you pick the folder named 10.0.0.0_something. In my PC the complete foldername is C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\10.0.0.0__b03f5f7f11d50a3a
Make sure the DLL’s are copied to your BIN folder and deployed to Azure
For all of your referenced DLL files that you need transfered to Azure you must make sure that the “Copy local” flag is set to True.
1.Find the Microsoft.ReportViewer.dll which is already added as a reference in your project, set Copy Local=true
2.Add the Microsoft.ReportViewer.Common.dll to the assembly references, by doing an add reference. Set Copy Local=true
3.Find the Microsoft.ReportViewer.ProcessingObjectModel.dll and Mircosoft.RevportViewer.DataVisualization.dll in your GAC (see above), copy them into a folder in your project then reference the copies of the assemblies. set Copy Local=true
4. Reference the Microsoft.Web.Infrastructure.DLL (c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\Microsoft.Web.Infrastructure.dll) and set Copy Local = True
Deploying the report files
Make sure your report files (the RDLC files) are copied to the BIN folder by setting “Build Action= Content” and ”Copy to output directory=Always”
Other
I believe it should be possible to make the Instance to actually execute the Microsoft Report Viewer 2010 Redistributable Package during boot using a Startup Task, read more about this in MSDN docs. But I havent tested this way, and personally i prefer to actually bring in the DLL’s in the deployment instead of executing a setup package – but that’s just my opinion.
And by the way: You should use the latest VS2010 version of the ReportViewer, if you havent upgraded yet – please do – as the new version has a lot of bug fixes and general user interface improvements. And it also supports export to Word…









