Getting named pipes working on Windows Server 2008

by Christoph Herold 24. January 2011 15:43

I spent the last few weeks working on a server application that uses named pipes. It worked well on the development and test systems, but when deploying to the staging environment, the named pipe server seemed to stop working. It did not quit out on me, though. The code was under the impression of having opened the named pipe server, but no clients were able to connect to the server. When checking with process explorer, the named pipes were not shown in the process' handles.

During my search I came across the following page, that pretty much describes the problem I was having: On it, several solutions are given, but most of them use the Windows API and not .NET. After trying a few things and looking at the named pipes examples of the All-in-one Code Framework on Codeplex, I finally managed to get things working. The important part is the PipeSecurity object passed into the NamedPipeServerStream constructor. I got the access rules from the All-in-one Code Framework, but the magic line is the SetSecurityDescriptorSddlForm code. It is also necessary to have this line BEFORE setting the access rights, as otherwise I got no change in the behavior.

PipeSecurity pipeSecurity = new PipeSecurity();

// Set to low integrity level

// Allow Everyone read and write access to the pipe.
pipeSecurity.SetAccessRule(new PipeAccessRule("Authenticated Users",
    PipeAccessRights.ReadWrite, AccessControlType.Allow));

// Allow the Administrators group full access to the pipe.
pipeSecurity.SetAccessRule(new PipeAccessRule("Administrators",
    PipeAccessRights.FullControl, AccessControlType.Allow));

using (this.namedPipe = new NamedPipeServerStream(pipeName,

I guess anyone would have come up with the "S:(ML;;NW;;;LW)" string to pass into the method. It seems straightfoward enough :-)

Well, anyways, if you encounter a similar problem, I hope this saves you some time. And for all of you who want the explanation of that string, just head on over to the msdn documentation: and The S: tells us, that we're dealing with an SACL, ML stands for SDDL_MANDATORY_LABEL, no flags are given, NW means SDDL_NO_WRITE_UP, we then skip two object guids, and last but not least the LW is the account sid for SDDL_ML_LOW, which means "low level integrity". I think, to really get to the bottom of this, I need to learn a heck of a lot more about the windows security mechanisms. But for now, I'm just glad it works at all :-)

Tags: ,


Using NTLM (Windows) authentication with RIA services

by Christoph Herold 3. August 2010 14:38

When creating a new Silverlight business application using RIA services, it will automatically be configured to use Forms authentication. If you are developing an intranet application with single sign-on, you can easily switch the web.config to use Windows auth instead of forms. In my case, authentication still timed out, because the server still tried to access a database. You also have to disable the RoleManager and Profile services in the web.config to get Windows authentication running. This is a nice way to create out-of-browser intranet applications and still have single sign-on.

Tags: , ,


ASP.NET 4.0 web application always returns 404 error in IIS6

by Christoph Herold 25. July 2010 23:26

Today, I had a Windows Server 2003 system, on which I freshly installed .NET 4.0 and wanted to deploy an ASP.NET 4.0 application in it. Sounds simple enough, but everytime I tried to access the application, I got a 404 error. In my case, I had an MVC2 application, for which I also enabled the wildcard mapping (I know, it's not required with 4.0, but I did it anyways, just in case). When it was enabled, I got 404s for every request. When I took it out, at least a simple text file was delivered instead of a 404 error.

Well, the solution was very simple, but it took a while to find. The ASP.NET 4.0 web service extension was disabled. So, if you keep getting 404s for your ASP.NET application, check in the Webservice Extensions folder in the IIS Manager if the ASP.NET 4.0 extension is enabled.

Tags: , , , ,


550 Die verwendete Absenderadresse gehoert nicht zu Ihrem authentifizierten STRATO Paket.

by Christoph Herold 16. November 2009 17:08

Today, one of my customers noticed, that the contact form on his site was not working anymore. Since nothing had changed for quite a while, I went to look, and it was actually so. A short check with the error returned from the SMTP mail library (PEAR_Mail) told me, the error was

550 Die verwendete Absenderadresse gehoert nicht zu Ihrem authentifizierten STRATO Paket.

For those of you who don't understand german, it translates roughly to "The used sender's address does not belong to your authenticated STRATO account." So I thought, no sh*t, it never has been, because I send the mails using the email address the user enters, so my customer can simply click "reply" in his mail program. This had never been a problem before, so why was it now. What complicated the matter even more, was that there is another form on the page, that also uses data entered by the user as the sender's address, and it worked perfectly well.

To keep things short: After tracing the tcp communication, I could not find any relevant difference. So, I tested sending a mail with a simple "This is a test" message. What can I say: It worked! Björn's an my guess is, that the STRATO mail server uses a spam filter and did not accept my mail due to its content. I removed some superfluous server data always submitted when sending a contact mail, and now things are working again. That error message, though, is really misleading, and I hope they change it to something more meaningful.

So, if anyone else has this problem, try checking your mails content. It might be "spammy" :-)



OrderBy, Distinct, and LINQ's optimization skills

by Christoph Herold 16. July 2009 12:04

Today, I was dumbfounded by LINQ's optimization skills. I built a query over a list of items, which have an assigned category and a display order. I wanted to fetch a list of the distinct categories, to display them as an overview, and have them sorted according to the order of the entries themselves. My LINQ query looked something like this:

var categories = context.Entries
    .OrderBy(e => e.DisplayOrder)
    .Select(e => e.Category)

Everything seemed to work, but when I started ordering things around, the categories would remain as they were. What I also noticed, was that they were ordered alphabetically, which perplexed me. I decided to look at the generated query, and lo and behold, there was not a single ORDER BY clause in it. I took the generated query, added my own order by clause to it, and got an error:

ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

Of course: Distinct probably just sorts the values to make filtering out duplicates easier. I left out the Distinct() method, and my ordering was the way I wanted to have it.

I have not yet worked on a sql-based solution for this, since my structure holding the categories handled duplicate filtering by itself. And my data barely has any duplicates in it anyways, so I left it at that.

But what amazed me, was that LINQ actually left out the order by on its own accord, since it would have caused an error. The LINQ to SQL parser really knows, what it's doing, although in my case, I would have liked to get some sort of warning, that the query will not behave as expected. Nonetheless, I love LINQ :-)

Tags: , ,


jQuery UI DotNetNuke integration

by Christoph Herold 3. April 2009 12:04

I just launched a new project at codeplex aiming at the integration of jQuery UI in DotNetNuke: The first releases are already available in form of DNN module packages containing the core functionality, including infrastructural code to include jQuery and jQuery UI, two web controls for the Tabs and Datepicker widgets, and the smoothness theme.

Also available are module packages for three more themes: Cupertino, UI Darkness and UI Lightness. Further skins are actually quite easy to package and will follow over time, or when someone issues a request for one ;-)

So please, start grabbing the releases and giving me feedback.

Tags: , , , ,


Bogus errors from ASP.NET compiler

by Christoph Herold 18. March 2009 17:43

I just wasted another hour, trying to figure out, what exactly ASP.NET was trying to tell me, when giving me an "ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)." message on compiling my ascx file.

Ok, so I used a custom namespace, but I've done that hundreds of times, so that shouldn't be the problem. I also had a custom base class inheriting from UserControl. Also, nothing I haven't done before. So what was the issue now?!

I basically retyped everything concerning the namespace and class names in all files, but nothing helped. So I reverted to commenting out my code. This helped me find the issue: I used a

<% if (somethingOrOther) { %> Some code here <% } %>

construct in my ascx-file (Please don't start an argument on whether this is good practice or not. I know it's not the cleanest way to do things, but that is not the concern here :-) ), and actually forgot to put in the closing <% } %>. Ok, my fault, but shouldn't you get a better Compiler message than "ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl)."?!

So, if you encouter this error (and believe me, I've had it more than once due to typos), and are 100% positive you've spelled everything correctly, check for unbalanced parentheses!

Tags: , , , ,


Be careful when reusing ListItems

by Christoph Herold 17. March 2009 12:12

Yesterday, I had one of those WTF moments. I had a page with a form for entering two addresses. Both had the same fields, including a RadioButtonList with identical items. Since the items are resourced, I decided to optimize the performance by reusing the ListItems like so:

ListItem[] items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");

Simple eh. Everything seems to be ok. And was I amazed, when I tested it, and I always got the SelectedItem to be the one selected in salutation2. I double-checked every location were I was storing the values, in case I forgot to change the field name after copy/pasting. But everything was correct, as far as I could tell. I even checked the values submitted by the browser, they were also correct.

Finally, it hit me: The ListItem has a Selected property, and it is used to find the RadioButtonLists SelectedItem property. And since I reused the items, the first list parses its items on postback, sets the appropriate ListItem's Selected property to true. Same thing happens with the second RadioButtonList. And since the ListItems are used in both lists, the last one wins.

So, I changed my code to look like this:

ListItem[] items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");
items = new ListItem[2];
items[0] = new ListItem(this.GetString("salutation.Mister"), "Mr");
items[1] = new ListItem(this.GetString("salutation.Misses"), "Mrs");

Now everything works as it should. So next time, be careful when reusing your ListItems!

Tags: , , ,


Monty Python's Spamalot musical

by Christoph Herold 29. January 2009 13:29

Last night, I went to visit Monty Python's Spamalot musical in Cologne. I had no idea, what to expect from it, and I was quite sceptical concerning the german translation. I was very surprised by the job, the whole team has done. It was very funny, in typical Monty Python style, many unexpected gags, and very ludicrous. I actually believe, they got some gags in german, that weren't in the english version. At least, I wouldn't know, how to translate it, to make it funny :-) I'm very interested in the english version, though. Humor is definitely best in the original language. Nonetheless, the musical is definitely worth seeing.


Upgrade hassles with SQL Server 2008

by Christoph Herold 28. January 2009 10:36

Yesterday, I wasted a few hours trying to upgrade my SQL Server 2005 installation to 2008. Actually, upgrading is a simple process. You can simply select, which instance to upgrade, and the installer does the rest. It worked absolutely fine for my regular instance. I got some installation errors for a component, but didn't mind that at first. Everything seemed to be working.

At least I thought so, until I noticed, WHAT component got the errors. The SQL Server Management Studio was not installed. And the older 2005 version isn't able to connect to 2008. Bummer.

So I thought, let's try to reinstall it. Same error: "The error code is 2349." When you copy the details to the clipboard, you at least find the URL, that gives you the information, that the SQL Server Native Client is causing the trouble.

So I tried upgrading my SQL Server Express instance, but that was also dismissed with an error. Next, I uninstalled my SQL Server 2005 express instance, uninstalled the native client, and now added the Management Studio feature to my SQL Server 2008 instance. Same error, this is really getting frustrating.

So now, my last resort is to uninstall the whole d*rn thing and try to reinstall it. At least the installation only takes about 2 hours *cough*.

UPDATE: Even the complete uninstall did not help. As the error message states, the Native Client is supposedly not installed from the sqlncli.msi package. Well, I even uninstalled and reinstalled ONLY THAT package, to no avail. I'm still getting the same bogus error, when I try to install SSMS. Any help is welcome! I'm out of ideas.

But at least I'm not all alone with my ss2008 install problems. A friend of mine had other issues, but at least he was able to resolve them:

UPDATE 2: I have found out, that it's the Visual Studio Tools for Applications 2.0 installer, that is causing the problems. But I still have no idea why.

UPDATE 3: Rollback all rants :-) I found the issue. A file could not be replaced/updated by the installer. This was due to the fact, that my hard disk seems to be defective. The file could not be read, even less replaced. After renaming it, the installation went fine. So now, I have performed a scandisk, the errors have been cleared, and everything is in order. Guess I'll be backing up more often now, though.


Administration | Development

Month List

Impressum (for the Germans)

Christoph Herold

Dieses Weblog wird bereitgestellt und verwaltet durch

Christoph Herold
Ignaz-Semmelweis-Str. 37
41540 Dormagen

Sie erreichen mich unter