Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6779839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:26:07+00:00 2026-05-26T16:26:07+00:00

My ASP.NET 3.5 web service (asmx) is not throwing exceptions as SOAP faults. Everything

  • 0

My ASP.NET 3.5 web service (asmx) is not throwing exceptions as SOAP faults. Everything I’ve seen says this is the default behavior but mine is sending all exception information as text/plain. This is a new web application project with one service added. No other changes from out of the box behavior. How do I get SOAP faults?

Code:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class WebService : System.Web.Services.WebService
{
    [WebMethod]
    public string HelloWorld()
    {
        int test1 = 0;
        int test2 = 5 / test1;

        return "Hello World";
    }
}

Result:

HTTP/1.1 500 Internal Server Error
Server: ASP.NET Development Server/10.0.0.0
Date: Tue, 25 Oct 2011 21:39:23 GMT
X-AspNet-Version: 2.0.50727
Cache-Control: private
Content-Type: text/plain; charset=utf-8
Content-Length: 201
Connection: Close

System.DivideByZeroException: Attempted to divide by zero.
   at WebApplication.WebService.HelloWorld() in C:\....cs:line 23
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:26:08+00:00Added an answer on May 26, 2026 at 4:26 pm

    ASMX web services will only respond with SOAP if the request was SOAP. The testing page generated for you by the service doesn’t include the SOAP request envelope:

    POST http://server/service.asmx/HelloWorld HTTP/1.1
    Accept: */*
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 0
    Host: server
    

    A proper SOAP request looks like this:

    POST http://server/service.asmx HTTP/1.1
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "http://server/HelloWorld"
    Host: server
    Content-Length: 283
    Expect: 100-continue
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
        <HelloWorld xmlns="http://server/" />
      </soap:Body>
    </soap:Envelope>
    

    Notice the SOAPAction header field and the SOAP envelope content. If the request is a valid SOAP request the service will respond with a SOAP response. For the initial example, the following SOAP fault is the response:

    HTTP/1.1 500 Internal Server Error
    Date: Sat, 05 Nov 2011 16:55:17 GMT
    Content-Type: text/xml; charset=utf-8
    Content-Length: 695
    
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
        <soap:Fault>
          <faultcode>soap:Server</faultcode>
          <faultstring>
            System.Web.Services.Protocols.SoapException: Server was unable to process request. ---    &gt; System.DivideByZeroException: Attempted to divide by zero.
            at Service.HelloWorld() in C:\Test\Service.asmx.cs:line 35
            --- End of inner exception stack trace ---
          </faultstring>
          <detail />
        </soap:Fault>
      </soap:Body>
    </soap:Envelope>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp.NET web service (not WCF but the classic .asmx one with
I need to deploy an old style .asmx asp.net web service (not WCF) on
I'm building a traditional ASP.NET Web Service -- the style built using asmx. It's
I've create a regular old ASMX web service in ASP.NET and added SoapDocumentMethod(OneWay =
I have an ASP.NET web service running that accepts both HTTP POST and SOAP
I have created a new VS2008 ASP.Net Web service project, with the default name
Using this tutorial: http://dotnetslackers.com/articles/ajax/Using-jQuery-with-ASP-NET.aspx The web service is invoked such as Service1.asmx/HelloToYou The default
How would one configure asp.net / asmx to not use soap encoding at all
I am maintaining a SOAP web service (ASP.NET version 2.0) and I have to
I have an ASP.NET web service (.asmx). My service is defined like the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.