/egilh

Learning by doing

NullReferenceException in DefaultWsdlHelpGenerator

Posted on Wednesday, August 31, 2005 9:47 PM

I got this nasty error today when deploying a web service to a new server:

Server Error in '/' Application.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 1201:
Line 1202:    OperationBinding FindHttpBinding(string verb) {
Line 1203:        foreach (ServiceDescription description in serviceDescriptions) {
Line 1204:            foreach (Binding binding in description.Bindings) {
Line 1205:                HttpBinding httpBinding = (HttpBinding)binding.Extensions.Find(typeof(HttpBinding)); 

Source File: c:\windows\microsoft.net\framework\v1.1.4322\Config\DefaultWsdlHelpGenerator.aspx Line: 1203

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.DefaultWsdlHelpGenerator_aspx.FindHttpBinding(String verb) in c:\windows\microsoft.net\framework\v1.1.4322\Config\DefaultWsdlHelpGenerator.aspx:1203
   ASP.DefaultWsdlHelpGenerator_aspx.get_HttpPostOperationBinding() in c:\windows\microsoft.net\framework\v1.1.4322\Config\DefaultWsdlHelpGenerator.aspx:441
   ASP.DefaultWsdlHelpGenerator_aspx.get_ShowingHttpPost() in c:\windows\microsoft.net\framework\v1.1.4322\Config\DefaultWsdlHelpGenerator.aspx:456
   ASP.DefaultWsdlHelpGenerator_aspx.__Render__control13(HtmlTextWriter __output, Control parameterContainer) in c:\windows\microsoft.net\framework\v1.1.4322\Config\DefaultWsdlHelpGenerator.aspx:1435
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
   System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +29
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
   System.Web.UI.Control.Render(HtmlTextWriter writer) +7
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
   System.Web.UI.Page.ProcessRequestMain() +1929 

Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

The problem was that autoEventWireup was disabled in machine.config. DefaultWsdlHelpGenerator.aspx bombs as it requires the autoEventWireup to be true. You can fix it by adding the following to Web.Config in the site that hosts the web service:

<configuration>
   <system.web>
      <pages autoEventWireup="true" />
   </system.web>
</configuration>

KB324151 has more info on How to use the AutoEventWireup attribute in an ASP.NET Web Form by using Visual C# .NET




Feel free to drop a few cents in the tip jar if this post saved you time and money

Feedback

# re: NullReferenceException in DefaultWsdlHelpGenerator

4/17/2008 12:36 PM by Fatty

You just saved me a whole heap o' hassle with this! Thanks!


# re: NullReferenceException in DefaultWsdlHelpGenerator

7/10/2008 2:15 PM by Richard

Excellent! Although I think it would be better for performance to limit the change to the DefaultWsdlHelpGenerator.aspx file, by adding a @Page directive at the top.


Post Comment
Title
 

Name
 

Url

Protected by Clearscreen.SharpHIPEnter the code you see:
Comment