Coding Horror

programming and human factors

Custom wsdlHelpGenerator + webroot = error

Why are the smallest bugs in the .NET framework always the most disproportionately frustrating? Take the wsdlHelpGenerator element, for example. Sure, it seems straightforward enough; you want to replace the default crappy, random hash sorted list of Web Service methods with one that's (shock!) in alphabetical order. I know, it's crazy talk, but bear with me. So you'd...

  1. Make a copy of the C:WINDOWSMicrosoft.NETFrameworkv1.1.4322CONFIGDefaultWsdlHelpGenerator.aspx file
  2. Rename that file to CustomWsdlHelpGenerator.aspx and place it in the root of your Web Service solution
  3. Open the file and make a simple one-line modification, replacing Hashtable methodsTable with SortedList methodsTable
  4. Modify your Web.config to include the following:

  
<webServices>
<wsdlHelpGenerator href="CustomWsdlHelpGenerator.aspx" />
</webServices>

And it works great! Well, as long as you deploy your Web Service to a subfolder under the webroot (eg, http://staging.company.com/mywebservice/). However. If you deploy this very same code to a root URL (eg, http://mywebservice.company.com/, you get this exciting, ultra-fatal error:

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Exception in configuration section handler.

This makes deploying to production a lot more, uh, thrilling than it would otherwise be. Commenting the wsdlHelpGenerator line out "fixes" the problem. So does moving the webservice to a subfolder under the root.

This egregious bug in the .NET framework really pisses me off, particularly since it has persisted into 1.1 SP1. I can find lots of people complaining about this in Google Groups, but I can't find one single workaround. Can you? Class? Bueller? Bueller?

Written by Jeff Atwood

Indoor enthusiast. Co-founder of Stack Exchange and Discourse. Disclaimer: I have no idea what I'm talking about. Find me here: http://twitter.com/codinghorror