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: , , , ,


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: , , , ,


Developing WCF with HTTPS

by Christoph Herold 13. January 2009 21:22

I just ran across a really nice article describing how to create a self hosted WCF service using HTTPS bindings. It's a nice step-by-step instruction on how to create your own certificates, adding them to your store, configuring the Windows HTTP runtime, and configuring your WCF service. You can find the article on CodeProject at this url: Really nice article, helped me a lot. Kudos to Chris.

Also, Steve Johnson created a nice little GUI for the httpcfg command line tool, which you can find here: It's a nice addition to the article, so you are not completely bound to the console :-)

Tags: ,


DotNetNuke now with jQuery

by Christoph Herold 7. January 2009 11:06

I have been using jQuery with DotNetNuke for a while now, and was very happy to finally see it integrated into DotNetNuke. What makes me wonder, is that there is no central method for including it in DNN 4.9.1. The library has been placed into the folder ~/Resources/Shared/scripts/jquery, but the one usage I could find does not use the ClientScriptManager to include the script. Instead, it manually creates a Literal script control. This will cause the script to be included multiple times, if different controls use it simultaneously. Perhaps this will be "fixed" in a future release. Perhaps adding a method to the ClientAPI for including it would be a good solution for a global include mechanism.

Tags: , , , ,


SharePoint DateTimeField control and the order of its properties

by Christoph Herold 19. November 2008 17:37

Today, I was building a nice little page layout for SharePoint and wanted to use SharePoint DateTimeField control. Since the field I wanted to edit was DateOnly, I set the corresponding property, leaving me with this code:

<SharePointWebControls:DateTimeField runat="server" id="dtfArticleStartDate"
    DateOnly="true" FieldName="ArticleStartDate" />

Seems fine to me, but ASP.NET did not like it. Or rather, the control did not like it. I got an ArgumentException with the following StackTrace:

[ArgumentException: FieldName value is not specified.]
Microsoft.SharePoint.WebControls.FieldMetadata.get_Field() +150
Microsoft.SharePoint.WebControls.DateTimeField.CreateChildControls() +310
System.Web.UI.Control.EnsureChildControls() +87
Microsoft.SharePoint.WebControls.DateTimeField.set_DateOnly(Boolean value) +29

FieldName value is not specified?! As you can see in my code above, it is indeed specified. But the stack trace gives us more information: The exception occurs in the compiled ASPX file.

  • ASP.MYNEWSPAGE_ASPX__2072755151.__BuildControldtfArticleStartDate():
    - We are building my DateTimeField control.
  • DateTimeField.set_DateOnly:
    - We are setting the DateOnly property.
  • FieldMetadata.get_Field:
    - Getting the field is where the exception occurs.

Note my ASPX-code again: I first set DateOnly="true" and then FieldName="ArticleStartDate". Oh my god, this can't be true... The solution is very simple: change the order of the attributes/properties:

<SharePointWebControls:DateTimeField runat="server" id="dtfArticleStartDate"
    FieldName="ArticleStartDate" DateOnly="true" />

Against all good practices, the SharePoint team actually created a direct dependency between two properties. At least the stack trace directly tells you where things go wrong, so the solution is obvious. Nonetheless, I thought, this was worth noting. It actually made me laugh, when I encountered it. Another one of those nice little pitfalls when working with SharePoint :-)

Tags: , , ,


New FCKEditorProvider for DotNetNuke

by Christoph Herold 11. August 2008 16:18

A newer (beta) version of the FCKEditorProvider for DotNetNuke has been made available:

It finally integrates the newest version of FCKeditor, giving you much better styling support and various other features. So far, my tests have been quite positive with the new version.

One thing to note is the bothering "Red title" style, that is configured by default. If you wish to remove it, you can edit the fckconfig.js files located in the provider's "FCKeditor" and "Custom" folders. Just comment out the line that add the style to FCKeditor's custom styles, and you'll be rid of it.

Regards to Mauricio Márquez for his great work on the integration!

Tags: , , ,


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