Web Platform Installer crash when viewing Products or Applications

Today when I was trying to setup WordPress on my Windows 8 development machine the IIS Manager would crash with an System.OutOfMemoryException exception.

Exception:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.<br> ---&gt; System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid.<br>Check InnerException <span style="color: #0000ff">for</span> exception details. ---&gt; System.OutOfMemoryException: Out of memory.

After doing a quick Bing search turn up this article on the IIS.NET Forums and after clicking “Get New Web Platform Components” problem solved.

Node.js, JQuery and Mocha on Windows 8 x64 and PowerShell

Since the Microsoft Patterns and Practices symposium, I have been wanting to get started learning Node.js.  So I added the JumpStart Node.js to my Safari Books Online bookshelf and installed Node.js from http://nodejs.org/

The sample in the first chapter uses a Mongo db provider (MongoLab) but I decided to install mongo locally instead.  It installed easily using the Windows Quick Start.

I was on a roll until I got to the next chapter and tried to get the modules installed.  The sample uses Mocha for its unit tests.  It also uses jQuery.  Both proved to be a challenge to get working on my Windows 8 machine.

First issue is that Mocha requires a UNIX make command.  To get this I installed Cygwin with the development tools selected as specified in this StackOverflow post.  I then added the Set-Alias make “c:\cygwin\bin\make.exe” to my PowerShell profile.

That allowed the npm install mocha to succeed.

My Node.js sample uses jQuery so the next error I ran into was that jQuery install was not succeeding.  It failed on the Contextify dependency.  After a little goggling with Bing, I found that there are two development tools you need for Node.js development on Windows.  Python 2.7 and Visual C++. 

I had Python 2.7 installed but it wasn’t in the path, so that was a simple fix.  If figured that the C++ dependency would be an issue since I do a bunch of C++ development.  But when I ran the npm install contextify, I received.

error MSB8008: Specified platform toolset (v110) <span class="kwrd">is</span> not installed or invalid.
Please make sure that a supported PlatformToolset <span class="kwrd">value</span> <span class="kwrd">is</span> selected.

So back to StackOverflow and this helpful post pointed to the fact that if you have Visual Studio 2012 installed you need to set the VisualStudioVersion environment variable to 11.0 for MSBuild to pick the correct version.  So I added $env:VisualStudioVersion=”11.0” to my default PowerShell profile and Wallah!   npm install jquery succeeded.

So now I had jQuery, Mocha and Should all installed, so I typed in make test hoping for the best and no such luck.

./node_modules/.bin/mocha: line 2: dirname: command not found
./node_modules/.bin/mocha: line 4: uname: command not found

module.js:340
    <span class="kwrd">throw</span> err;
          ^
Error: Cannot find module <span class="str">'C:\mocha\bin\mocha'</span>
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Makefile:2: recipe <span class="kwrd">for</span> target `test' failed
make: *** [test] Error 1

It couldn’t find the dirname and uname commands so it was looking in the c:\mocha\bin\mocha directory.  At least this was a simple one.  Adding cygwin bin to the path corrected the error and my test finally ran!

So to summarize the steps I followed to get Mocha and jQuery working on Windows 8 x64 were.

  • Install Cygwin with development tools and add it to the path
  • Add Set-Alias make “c:\cygwin\bin\make.exe” to my PowerShell profile.
  • Install Python 2.7 and add it to the path
  • Add $env:VisualStudioVersion=”11.0” to my PowerShell profile. (If you have Visual Studio 2012 installed)

Misleading error in Cluster Validation Wizard

This weekend we were migrating a Hyper-V cluster form Windows Server 2008 R2 to Windows Server 2012.  Our hosts were HP DL360p Gen 8 servers connected to a HP P2000 G3 MSA iSCSI storage array. 

After getting our hosts all configured and connected to the SAN we were ready to install the cluster.  When we ran the Cluster Validation Wizard we received some warnings.  One of warnings seemed quite troubling. 

Test Disk 0 does not support SCSI-3 Persistent Reservations commands needed to support clustered Storage Pools. Some storage devices require specific firmware versions or settings to function properly with failover clusters. Please contact your storage administrator or storage vendor to check the configuration of the storage to allow it to function properly with failover clusters.

This appears to be a big problem because SCSI-3 Persistent Reservations are very important to the cluster working correctly. 

Continue reading

Passing values from your ASP.NET MVC Controller to Javascript

Inspired by John Papa’s Single Page Application series on Pluralsight, in my latest project I am making heavy use of the JavaScript MVVM pattern.  Since my application isn’t a true single page application I found myself in some cases needing use values from my Controller in my JavaScript methods.

After doing some research I came across this post from A. Friedman about Ngon a port he created of the Ruby Gon gem.  Ngon allows you to add a value to a ViewBag NGon property and then consume it in your JavaScript.

To use Ngon I can just add the NGonActionFilterAttribute to my RegisterGlobalFilters

<span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> RegisterGlobalFilters(GlobalFilterCollection filters)
{
   filters.Add(<span class="kwrd">new</span> NGonActionFilterAttribute());
   filters.Add(<span class="kwrd">new</span> HandleErrorAttribute());
}

So in my controller action I just set the Ngon values.

<span class="kwrd">if</span> (User.Identity.IsAuthenticated)
{
   ViewBag.NGon.UserName = User.Identity.Name;
   ViewBag.NGon.CurrentUserId = WebSecurity.CurrentUserId;
}

In my _Layout.cshtml file I added a @using NGon and a @Html.IncludeNGon() to the <head> section.

@<span class="kwrd">using</span> NGon
&lt;!DOCTYPE html&gt;
&lt;html lang=<span class="str">"en"</span>&gt;
    &lt;head&gt;
        &lt;meta charset=<span class="str">"utf-8"</span> /&gt;
        &lt;title&gt;@ViewBag.Title - My ASP.NET MVC Application&lt;/title&gt;
        &lt;link href=<span class="str">"~/favicon.ico"</span> rel=<span class="str">"shortcut icon"</span> type=<span class="str">"image/x-icon"</span> /&gt;
        &lt;meta name=<span class="str">"viewport"</span> content=<span class="str">"width=device-width"</span> /&gt;
        @Html.IncludeNGon()
        @Styles.Render(<span class="str">"~/Content/css"</span>)
        @Scripts.Render(<span class="str">"~/bundles/modernizr"</span>)
    &lt;/head&gt;
    &lt;body&gt;
...
 

And then I can just use the ngon object like this in my JavaScript

activate = function (callback) {
 
   config.currentUserId = ngon.CurrentUserId;
   config.currentUser = function () { <span class="kwrd">return</span> { id: function () { <span class="kwrd">return</span> ngon.CurrentUserId; } }; };
 
    messenger.publish.viewModelActivated({ canleaveCallback: canLeave });
    getActivityItems(callback);
},

Very elegant solution to the problem.  Ngon is now available as a Nuget package.

Unable to open Database Project after upgrading to SQL Server 2012 SP1

I recently upgraded SQL Server 2012 on my development machine to SP1.  Once it was installed, my solutions with SQL Server Database Projects complain that the version of SQL Server Data Tools is not compatible with the database runtime components install on this computer.

ssdt3

Both the “Learn more…” and “Get the latest version of SQL Server Data Tools…” links do not currently resolve to an active page.

Luckily  I was able to find Mr. Wharty’s Ramblings – Everything SQL blog which had the solution, install the latest version of the SQL Server Data Tools – November 2012 update and migrate the database projects.

Windows 8 installed on Lenovo W520 – Finally

Well, I finally got around to figuring out why I could not install the Windows 8 Release Preview on my Lenovo ThinkPad W520.  Every time I went to install the OS it would hang during boot.  That issue turned out to be that I needed to install on a GPT disk using the UEFI bios.

Before doing that I installed the latest bios from the Lenovo site.

After upgrading the Bios and backing up the little data I wanted to save, I proceeded to install the OS.  I went through the boot process fine, installed the installation files reboot and then hung at 90% when configuring devices.  After fiddling with the video driver settings Optimus, Integrated and Discrete, I tired disabling the wireless card and the install completed successfully.

After the installation was complete, I installed the Lenovo Windows 8 beta drivers turned the wireless adapter back on, crossed my fingers and rebooted and I am finally running Windows 8 on my Lenovo W520!

lenovowin8_2-624x455

Update:  After installing all the Windows 8 drivers there was one unknown device.  Turns out it was the ThinkPad Power Management Device.  I downloaded the Windows 7 driver from the Lenovo site and everything seems good.

Windows Server 2012 RC and Window 8 Release Preview are now available – Plus VS 2012

Time to start burning through bandwidth.

Latest pre release versions are now available

Windows 8 Release Preview
http://windows.microsoft.com/en-US/windows-8/download

Windows Server 2012 Release Candidate
http://technet.microsoft.com/en-us/evalcenter/hh670538.aspx

First found via http://msmvps.com/blogs/bradley/

Also Visual Studio 2012 Release Candidate is also available.
http://www.microsoft.com/visualstudio/11/en-us

Visual Studio 11 Beta – Dark Theme using White Background – Fix

Last night I was playing around with the Visual Studio 11 settings and something I did caused the dark theme to use a white background.  Reselecting the dark theme did not reset the background.  After consulting Bing, I found the fix.  This is a known issue with a simple fix.

http://blogs.msdn.com/b/davedev/archive/2012/05/07/help-visual-studio-11-beta-dark-theme-incorrectly-using-white-background.aspx

ASP.NET Web API replaces WCF Web API

The new MVC 4 beta was released last Thursday / Friday.  One of the big changes is the moving of the WCF Web API into the ASP.NET MVC code stream.

Get the bits and the initial documentation on the ASP.NET Web API page at http://www.asp.net/web-api

The team has provided some initial guidance on migrating from the WCF Web API to ASP.NET Web API on the WCF CodePlex site.

ScottGu has an overview on his blog along with a video of a presentation that he gave at the Belgium and Dutch TechReady events.

Jon Galloway interviewed Brad Wilson about the ASP.NET MVC 4 release.  Brad Wilson on ASP.NET 4 Beta and ASP.NET Web API

Henrik Nielsen the Principal Architect on the WCF Team has a post on the new HttpClient for ASP.NET Web API that has been back ported from .NET 4.5.

I plan on migrating my current project using the WCF Web API and ASP.NET MVC 3 to the new ASP.NET Web API and ASP.NET MVC 4 API this week.  After spending a lot of time last week getting Ninject work work with the WCF Web API, it looks like the ASP.NET Web API makes it trivial.  But it was still a good learning experience right?

I am also contemplating moving to the new .NET 4.5 beta when it is released.  It looks like the asynchronous support on C# 5 will be very useful with the new ASP.NET Web API.

Cool Development Utility: smtp4dev

The other day I needed to test the Mail functionality of an application I was developing on Windows 7 and I realized that the built in SMTP server had been removed.  I initially thought about just installing the free version of SmarterMail and configuring that but I decided to take a look and see what else I could find.  I ran across smtp4dev on CodePlex.  Codeplex Link

smtp4dev captures emails that are sent to localhost on whatever port you configure smtp4dev to listen on.  You can then inspect the formatting and content by choosing an entry in the list and selecting Inspect or View.

smtp4dev main screen

Inspect shows a window that lets you see the MIME parts (Source, Headers, Body) and the raw Message Source. View opens the email message in your default email program.

Message Inspect Window

smtp4dev even supports SSL/TTL allowing you to specify a certificate to use for the secure connection.

smtp4dev options

smtp4dev is an easy to use utility that provides some powerful capabilities that can make integration testing email functionality in your apps easier.