Wednesday, June 20, 2012

Hyper-V Manager cannot connect–make sure RPC service is running

My Hyper-V Server 2008R2 lab environment is so stable I rarely fire up the Hyper-V MMC snap-in. The last time I opened it was four months ago when I switched from booting it from a USB stick to booting it from an IDE drive. I opened it today and it gave me the typical “Cannot connect to the RPC service on computer 'Servername'. Make sure your RPC service is running.” error. My quick troubleshooting steps follow:

  1. I double checked to make sure the IP address and host name were still specified in the \etc\hosts file. It was.
  2. I attempted to remote into the Hyper-V server directly using Remote Desktop and was met with the “Your password has expired” message. I reset the password, and voila – the Hyper-V manager MMC connected to my server and displayed the current state of my VM’s.

Tuesday, June 19, 2012

Blank Page when Publishing a Silverlight App

I just deployed a new Silverlight application to a Windows Server 2003 box as a new website and was surprised with a blank page when I launched the application. No error messages or warnings, just a completely blank page.

A quick web search and I realized I had been here before. You have to register the MIME types, .xaml and .xap, in IIS for the website. I added them for a previous website, but I didn’t add them at the server root.

Simple instructions to add the MIME types to IIS can be found on Jacqui’s Dev Blog under Deploying Silverlight Application - Why Blank?! Note the first blog post comment that suggests adding the additional .xap application/x-silverlight-app and .xbap application/x-ms-xbap MIME types. I didn’t need to add the .xbap to get my application working, but I did need the .xap.

Wednesday, June 6, 2012

Visual Studio Project – unavailable

one broken pencil tip in a setI hadn’t opened a particular Visual Studio solution since getting a replacement workstation and rebuilding my developer environment. Upon opening, one of the projects in the solution would not open and showed up as “(unavailable)” as shown below.

vs 2010 project (unavailable)

The Output window displayed the not very useful message, “The project type is not supported by this installation.”

project type not supported

In order to find out why, I opened the LPM.csproj file using Wordpad, not in Visual Studio, and scanned through the properties looking for insight as to why the project was unsupported. It didn’t take long to find the issue.

This project was using MVC 3 and the Entity Framework 4.1 which were not installed on my new workstation. I installed EF 4.1 on my old workstation specifically so I could use the MvcScaffolding NUGET package with an existing database design for a product technology upgrade. See my previous posts detailing some of my experiences with MvcScaffolding and the ASP.NET MVC framework.

missing-EF-4.1

After installing both ASP.NET MVC 3 and EF 4.1, all the projects in the solution opened as expected. Another small victory!

 

photo credit: ruurmo / CC BY-SA 2.0

Tuesday, May 29, 2012

Sterling Serialization issue - Object of type 'System.Int32' cannot be converted to type 'System.DateTime'

sterling forksI created a new data model class to store in a Sterling NoSQL database. On the first and all subsequent attempts to save or retrieve data of this type, I received the error message at the bottom of this post. A number of other people reported similar issues. Apparently it is some type of serialization/deserialization issue. I didn’t find a suggested resolution, but on a whim, moved the AssessmentDate DateTime property from the top of the list of properties in the class to the bottom and that seemed to resolve the issue.

class definition

Object of type 'System.Int32' cannot be converted to type 'System.DateTime'.

   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)
   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Wintellect.Sterling.Serialization.PropertyOrField.<get_Setter>b__0(Object obj, Object prop)
   at Wintellect.Sterling.Serialization.SerializationHelper.<>c__DisplayClassd.<_CacheProperties>b__5(Object parent, Object property)
   at Wintellect.Sterling.Serialization.SerializationHelper.Load(Type type, Object key, BinaryReader br, CycleCache cache)
   at Wintellect.Sterling.Database.BaseDatabaseInstance.Load(Type type, Object key, CycleCache cache)
   at Wintellect.Sterling.Database.BaseDatabaseInstance.Load(Type type, Object key)
   at Wintellect.Sterling.Database.BaseDatabaseInstance.Load[T,TKey](TKey key)
   at Wintellect.Sterling.Keys.TableKey`2.<.ctor>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at LeanAssessmentNav.Views.Register.<BindLists>b__6(TableKey`2 a)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at LeanAssessmentNav.Views.Register.BindLists()
   at LeanAssessmentNav.Views.Register..ctor()

 

photo credit: Le Petit Poulailler / CC BY 2.0

Why isn’t my Sterling database persisting between application loads?

Sterling repository (silver bowl)I’m using Sterling, a NoSQL database for .Net, Silverlight, and Windows Phone, to persist some data in a Silverlight 4 application. The intent is to persist it using Isolated Storage. It was obvious that the data was temporarily persisting because the stored data was available on multiple different views in the application. The trouble showed up when I stopped debugging and later started debugging again, the application re-launched and none of the previously persisted data was available.

Initially I was thinking that using the Visual Studio ASP.Net Development server was not maintaining Isolated Storage between application launches. It was far more simple than that. By default, Sterling uses an in-memory driver. If you want to persist using Isolated storage, you must pass an instance of the IsolatatedStorageDriver as an argument when Registering the Database. Note the difference in the samples below.

In Memory

Database = _engine.SterlingDatabase.RegisterDatabase<YourSterlingDatabase>();

Isolated Storage

Database = _engine.SterlingDatabase.RegisterDatabase<YourSterlingDatabase>(new Wintellect.Sterling.IsolatedStorage.IsolatedStorageDriver());

 

photo credit: Neil Noland / CC BY-SA 2.0

Wednesday, April 11, 2012

Get Started Using NuGet on Visual Studio 2010

You’ve been hearing things about NuGet, but aren’t sure where it is our how to use it. This is a basic instruction on how to get started.

Why NuGet? Developer Productivity. It makes it easier to do things like add Asp.Net Ajax or other libraries and utilities to your project without constantly searching the web for the download and installation process. It is great for items you add to your solutions regularly, but don’t always remember the steps because it has been a while since the last time.

NuGet

  1. Go to NuGet.org to download and install NuGet, a Visual Studio extension that makes it easier to download and install third party libraries in a Visual Studio project.
  2. Restart Visual Studio, if you had it open.
  3. Open the project you want to add the utility or library to.
  4. Click “Manage NuGet Packages” under the Visual Studio 2010 “Project” menu. image
  5. Search for a utility you are interested in, such as “AjaxControlToolkit”, “Modernizr”, or “MvcScaffolding”.
  6. Click the “Install” button.

Wednesday, March 28, 2012

Uninstalling a Failed SQL Server 2008 Installation

frustrationLast night at a SQL Server User Group meeting, one of the attendees was describing the trouble he was having uninstalling a failed SQL Server installation. There was some kind of problem that caused it to fail on the database engine installation. That sounded exactly like a problem I had installing SQL Server 2008R2 as a named instance alongside SQL Server 2005 just a few weeks before.

My installation was failing because I was attempting to install SQL Server 2008 (not R2) from an actual Microsoft DVD (most of the time I am installing from an MSDN iso download). After much of the installation was complete, a dialog popped up prompted for media containing a path to a SQL Server 2008 R2 executable. I wasn’t trying to install R2, so I’m not sure why the prompt. I ignored the prompt and continued the installation which failed (no surprise there). After the error, I decided I would just uninstall the non-R2 instance and install SQL Server 2008 R2, but the uninstall wizard would not work.

For posterity sake, the blog post that I used to uninstall the failed installation was Fun with software : uninstalling SQL Server 2008 R2 Evaluation Edition by Aaron Bertrand. The article is about uninstalling an eval edition, but it worked for me on an RTM or SP1 copy.

 

photo credit: peterhess / CC BY 2.0

Tuesday, February 28, 2012

Hyper-V Lab Experiment; Attack of the Snapshots

DeLorean time machineThis is a brief chronicle of the effect of re-creating a Virtual Machine from a Virtual Hard Drive that had Snapshots taken and not merged back into the parent image.

Background

In August 2010, I created a Hyper-V lab with a Windows 7 development VM and a Server 2008R2 testing VM. The VM hard disks, virtual machines, and snapshots were stored on the SATA hard disk. The Hyper-V Server 2008R2 host was installed on a bootable USB pen drive.

Apparently around November 2010 and over the course of 2011 I created a few snapshots of the Windows 7 VM.

Fast forward to a couple weeks ago

My Hyper-V environment lost power and when it restarted the BIOS failed to recognize the Kingston USB pen drive that Hyper-V was booting from. Result: My lab was down. This happened one other time, but after some fiddling with the BIOS, I  was able to get the USB drive to be recognized.

In order to prevent this from happening in the future, I replaced the USB pen drive by installing Hyper-V Server 2008R2 on an IDE drive, plugged it into my lab box and booted. I created a new Virtual Machine using the existing Window 7 Virtual Hard Drive and powered up my development VM. Upon a quick glance everything looked fine.

Missing Files and Programs

A few days later while logged into my Dev VM, I noticed several of my files and directories were missing, Microsoft Office wasn’t installed, and SQL Server said the trial had expired. What?!?

A quick check of the Windows Event log and there was an entry that Windows was not shut down properly on November 11, 2010, but was back up and running on Feb 12, 2012. Suddenly I was missing over a year of development activity; not really. 

Don’t Panic!

November 11, 2010 was the date the first snapshot was taken. All the activity since then was in the snapshot differencing disks (3 files with a .AVHD extension).

I had a Windows Image Backup and regular full backups, but instead of restoring from backup, I decided to have a little fun with the Hyper-V management console instead.

A little research and I found this article about merging differencing disks. It isn’t the best reference you can find because it doesn’t have screenshots of the process like this one. I actually backed up the parent VHD and child AVHD files and renamed the AVHD files VHD, but it appears the renaming process is unnecessary. Otherwise after using the Hyper-V management console to merge each of the AVHD files to their parent drives, I powered up the dev VM after merging and everything was back to the state prior to the initial power outage. Success!

Moral of the Story

If you use a Hyper-V snapshot to test a Windows Update or some other configuration change that you want to be able to roll back out of, make sure to merge the snapshot back into the VM. Don’t leave it in a snapshotted state. Especially not with multiple active snapshots.

Reference: Hyper-V: Avoid using differencing disks on virtual machines that run server workloads in a production environment.

photo credit: pnoeric / CC BY-SA 2.0

Thursday, February 16, 2012

Error 2337 Installing SQL Server 2008R2 in Virtual PC 2007

Issue

Last year I was preparing for an fwPASS presentation on Report Viewer 3.0 by installing SQL Server 2008R2 in a virtual machine using Virtual PC 2007. I kept getting an error 2337 indicating that the disk may have been corrupt or damaged. I was installing it from a .iso image I downloaded from my MSDN Ultimate subscription. I used the Virtual PC “capture iso image” functionality to mount the iso as a disk. I downloaded another copy of the iso image and repeated the process with the same results. Due to time constraints, I reverted back to SQL Server 2005 and Report Viewer 2.0 for that presentation, highlighting features new to 3.0 using screenshots.

Physical and Hyper-V Success

Since then I have successfully installed SQL Server 2008R2 successfully multiple times on bare metal physical servers and in VM’s using Hyper-V Server 2008.

VPC Still an Issue

Fast forward to this week. I was setting up a development sandbox in a VM. Again I was installing SS2008R2 by mounting the image in VPC 2007 and was faced with the same Error 2337. Seriously? This issue hasn’t been resolved yet? A quick search on the error resulted in this helpful post Getting error 2337 installing SQL Server on a VPC on the SQL Skills blog.

Solution

I didn’t have any blank DVD’s on hand for burning the image, so I decided I would use MagicDisc to mount the iso file on my host machine, instead of using VPC’s capture iso functionality. That solved the problem.