Custom wsdlHelpGenerator + webroot = error

April 7, 2005

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:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG\DefaultWsdlHelpGenerator.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?

Posted by Jeff Atwood
4 Comments

I was going to try to be glib and recommend a Response.Redirect, but I thought I'd better look it up first :)

This looked important, but I don't know whether it's what you're hitting (the file path bit):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/gngrfwsdlhelpgenerator.asp


Remarks
...
The value of href is a file path, not a URL. The file path can be relative or absolute. If it is relative, it is relative to the location of the configuration file.

Tristank on April 8, 2005 4:04 AM

I can't get any combination of path to work when the web service is running at root ( eg http://webservice.com/ ). I've tried "file.aspx", "x", "/file.aspx", "\file.aspx", "(full c drive path)\aspx." and every other combination. It appears to be a pure bug based on running as root.

Jeff Atwood on April 8, 2005 11:30 AM

Yep, looks that way :(

Ladybug, here we come.

Tristank on April 13, 2005 9:30 AM

you might try URL rewriting??? /whatever.asmx could be "rewritten" to /projName/whatever.asmx, though this doesn't really fix the problem.

Greg on February 27, 2008 10:04 AM

The comments to this entry are closed.