Tuesday, September 10, 2013

Extension Method for DB Reader

I was doing some quick and dirty data access for a demo program the other day. I was annoyed by having to call reader.IsDbNull() every time a DB field was a nullable simple type. My buddy Milenko and I created the following to make things look a little neater:

public static class ExtensionMethods
{
    public static T? GetNullableValue(this IDataRecord reader, string fieldName) where  T: struct
    {
        int ordinal = reader.GetOrdinal(fieldName);
        if (reader.IsDBNull(ordinal))
        {
             return null;
        }
        return (T)reader.GetValue(ordinal);
    }
}

Friday, March 29, 2013

Node.js on Windows Azure - Issue With WebMatrix

I am going through some of the node.js material on Pluralsight. I am currently working on the Node in Windows and Azure modules.

I'm pretty sure that I went through the steps as described in the vids for getting WebMatrix working for an Azure website. I was able to create and publish a working node.js website to Azure, but I couldn't get it run locally (the browser showed a 500 error). I tried running the Etw.bat file that comes with iisnode, and I saw the following:

First, a whole bunch of events that said iisnode scheduled a retry of a named pipe connection to the node.exe process", followed by the event iisnode was unable to establish named pipe connection to the node.exe process. Finally, I saw iisnode request processing failed for reasons unrecognized by iisnode.

The page that showed the 500 error recommended that I make sure that the app pool user had permissions to the folders where the website was, C:\Users\Steve.Harclerode\Documents\My Web Sites. So I made sure that IIS APPPOOL\DefaultAppPool had full permissions, but I saw the same error. I even tried giving full permissions to Everyone for the folder, but that also failed.

I copied the app to a folder under a currently running iisnode application, and I was able to run it from there just by browsing to it from IIS. Unfortunately, that folder is under C:\Program Files, and I couldn't save files there unless I logged in as admin

What finally worked was to choose Add Application under IIS and select the original folder. Honestly, I'm not sure why this worked, since WebMatrix runs the program using another port, in my case 34581. I'm hoping wiser minds than mine will comment on this blog. :-)

Friday, March 22, 2013

BizTalk is Alive!

I have heard (or read) several people claiming that "BizTalk is dead." Microsoft seems to disagree though, they just released BizTalk 2013 to MSDN. I hear through the grapevine that it will be generally available April 1.

Wednesday, March 20, 2013

SharePoint 2013 Configuration Error

I don't normally just post links, but this one saved my butt for a single server installation of SharePoint 2013. The error message I saw was "The SDDL string contains an invalid sid or a sid that cannot be translated.". I saw the error while I was running the configuration wizard.