Error while adding a webservice to an existing webapplication (ASP.NET)

H

harbi

I've an existing web application and I'm trying to add a new webservice to
it. I'm using VS.NET, ASP.NET/C# and Framework 1.0. I added a new web
service into a sub-folder in the UI project and created a new webservice in
it and modified the namespace so that the webservice and the webapplication
gets compiled into one assembly. In IIS I made the sub-folder containing the
new webservice into an Application and copied the respective dlls into a bin
folder under this sub-folder. When I try to access the webservice via the
browser it gives me the error mentioned below. If I append '?wsdl' to the
URL, it generates the service description fine but If I try using wdsl.exe
to generate a proxy it gives me the same error as below. Am I missing
anything? Any kind of help will be appreciated. Thanks.

========Error=================
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 1191:
Line 1192: OperationBinding FindHttpBinding(string verb) {
Line 1193: foreach (ServiceDescription description in serviceDescriptions) {
Line 1194: foreach (Binding binding in description.Bindings) {
Line 1195: HttpBinding httpBinding =
(HttpBinding)binding.Extensions.Find(typeof(HttpBinding));


Source File:
c:\windows\microsoft.net\framework\v1.0.3705\Config\DefaultWsdlHelpGenerator
..aspx Line: 1193

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.0.3705\Config\DefaultWsdlHelpGenerator
..aspx:1193
ASP.DefaultWsdlHelpGenerator_aspx.get_HttpGetOperationBinding()
ASP.DefaultWsdlHelpGenerator_aspx.get_ShowingHttpGet() in
c:\windows\microsoft.net\framework\v1.0.3705\Config\DefaultWsdlHelpGenerator
..aspx:381
ASP.DefaultWsdlHelpGenerator_aspx.__Render__control13(HtmlTextWriter
__output, Control parameterContainer) in
c:\windows\microsoft.net\framework\v1.0.3705\Config\DefaultWsdlHelpGenerator
..aspx:1376
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() +1900
 
H

harbi

Nevermind ... I got the solution.

In the Web.Config of the Web Application I had a <pages> element under
<system.web> and I had set the 'autoEventWireup' attribute to false. I
simply removed the 'autoEventWireup' and it solved the problem. I guess the
attribute was messing up the call to the WebService in someway... maybe the
DefaultWsdlHelpGenerator.aspx page requires the autoEventWireup to be true
so that it can call default EventHandlers for the page. Not including this
attribute sets it to true by default according to MSDN. Since VS.NET by
default sets the autoEventWireup to false in the Page directive of the .aspx
pages(when new ones are added), this allowed me to delete the attribute from
the Web.Config without having to make any changes to my .aspx pages. Phew !!
.... this was a tough one.

-H

harbi said:
I've an existing web application and I'm trying to add a new webservice to
it. I'm using VS.NET, ASP.NET/C# and Framework 1.0. I added a new web
service into a sub-folder in the UI project and created a new webservice in
it and modified the namespace so that the webservice and the webapplication
gets compiled into one assembly. In IIS I made the sub-folder containing the
new webservice into an Application and copied the respective dlls into a bin
folder under this sub-folder. When I try to access the webservice via the
browser it gives me the error mentioned below. If I append '?wsdl' to the
URL, it generates the service description fine but If I try using wdsl.exe
to generate a proxy it gives me the same error as below. Am I missing
anything? Any kind of help will be appreciated. Thanks.

========Error=================
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 1191:
Line 1192: OperationBinding FindHttpBinding(string verb) {
Line 1193: foreach (ServiceDescription description in serviceDescriptions) {
Line 1194: foreach (Binding binding in description.Bindings) {
Line 1195: HttpBinding httpBinding =
(HttpBinding)binding.Extensions.Find(typeof(HttpBinding));


Source File:
c:\windows\microsoft.net\framework\v1.0.3705\Config\DefaultWsdlHelpGenerator
.aspx Line: 1193

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.0.3705\Config\DefaultWsdlHelpGenerator
.aspx:1193
ASP.DefaultWsdlHelpGenerator_aspx.get_HttpGetOperationBinding()
ASP.DefaultWsdlHelpGenerator_aspx.get_ShowingHttpGet() in
c:\windows\microsoft.net\framework\v1.0.3705\Config\DefaultWsdlHelpGenerator
.aspx:381
ASP.DefaultWsdlHelpGenerator_aspx.__Render__control13(HtmlTextWriter
__output, Control parameterContainer) in
c:\windows\microsoft.net\framework\v1.0.3705\Config\DefaultWsdlHelpGenerator
.aspx:1376
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() +1900
 
C

Chris Muench

WOW! I was hunting for this also for more then two hours.
THere is no KB article or anything else about this....
But all .NET Code Profilers complain about setting
autoEventWireup to true (so I changed it to false).

I will request MS to write a KB article about this

Thanks again

Chris Muench
eMVP

-----Original Message-----
Nevermind ... I got the solution.

In the Web.Config of the Web Application I had a <pages> element under
<system.web> and I had set the 'autoEventWireup' attribute to false. I
simply removed the 'autoEventWireup' and it solved the problem. I guess the
attribute was messing up the call to the WebService in someway... maybe the
DefaultWsdlHelpGenerator.aspx page requires the autoEventWireup to be true
so that it can call default EventHandlers for the page. Not including this
attribute sets it to true by default according to MSDN. Since VS.NET by
default sets the autoEventWireup to false in the Page directive of the .aspx
pages(when new ones are added), this allowed me to delete the attribute from
the Web.Config without having to make any changes to my .aspx pages. Phew !!
.... this was a tough one.

-H

harbi said:
I've an existing web application and I'm trying to add a new webservice to
it. I'm using VS.NET, ASP.NET/C# and Framework 1.0. I added a new web
service into a sub-folder in the UI project and
created a new webservice
in
it and modified the namespace so that the webservice
and the
webapplication
gets compiled into one assembly. In IIS I made the sub-
folder containing
the
new webservice into an Application and copied the
respective dlls into a
bin
folder under this sub-folder. When I try to access the webservice via the
browser it gives me the error mentioned below. If I append '?wsdl' to the
URL, it generates the service description fine but If I try using wdsl.exe
to generate a proxy it gives me the same error as below. Am I missing
anything? Any kind of help will be appreciated. Thanks.

========Error=================
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 1191:
Line 1192: OperationBinding FindHttpBinding(string verb) {
Line 1193: foreach (ServiceDescription description in
serviceDescriptions)
{
Line 1194: foreach (Binding binding in description.Bindings) {
Line 1195: HttpBinding httpBinding =
(HttpBinding)binding.Extensions.Find(typeof (HttpBinding));


Source File:
c:\windows\microsoft.net\framework\v1.0.3705
\Config\DefaultWsdlHelpGenerator
.aspx Line: 1193

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.0.3705
\Config\DefaultWsdlHelpGeneratorASP.DefaultWsdlHelpGenerator_aspx.get_HttpGetOperationBind
ing()
ASP.DefaultWsdlHelpGenerator_aspx.get_ShowingHttpGet() in
c:\windows\microsoft.net\framework\v1.0.3705
\Config\DefaultWsdlHelpGenerator
.aspx:381
ASP.DefaultWsdlHelpGenerator_aspx.__Render__control13 (HtmlTextWriter
__output, Control parameterContainer) in
c:\windows\microsoft.net\framework\v1.0.3705
\Config\DefaultWsdlHelpGenerator
.aspx:1376
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() +1900


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top