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 6246395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:40:50+00:00 2026-05-24T12:40:50+00:00

I have a diagnostic tool which tests a web service. I want the tool

  • 0

I have a diagnostic tool which tests a web service.

I want the tool to report when there are problems, so I have deployed a service with a problem with the contract to test it.

When I browse to it I get a page with a very descriptive message such as:

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true,
whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL
export extension:
System.ServiceModel.Description.DataContractSerializerOperationBehavior
contract: DataContract for type XXX cannot be added to DataContractSet since type
XXX with the same data contract name XXX in namespace XXX is already present
and the contracts are not equivalent etc..

What I want is to be able to call:

myErrorMsg = WebClient.DownloadString("MyBadService.svc");

and get this useful error message as a string, however I get the following WebException:

The remote server returned an error: (500) Internal Server Error.

How can I get the same error message I received in the browser returned as a string, without getting an exception?

Thanks.

  • 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-24T12:40:50+00:00Added an answer on May 24, 2026 at 12:40 pm

    You have to catch the exception and read the response.

    catch (WebException exception)
    {
      string responseText;
    
      var responseStream = exception.Response?.GetResponseStream();
    
      if (responseStream != null)
      {
          using (var reader = new StreamReader(responseStream))
          {
             responseText = reader.ReadToEnd();
          }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As part of a tool I'm writing I want to have a diagnostic that
We have a part of our program which can save a diagnostic file for
I have an application which takes a string value of the form %programfiles%\directory\tool.exe from
I want to have a diagnostic log that is produced by several tasks managing
I have a WinForms application in which I want to be able to provide
I have a software diagnostic page on which I would like to list the
I have to run a tool from our internal website. There are few inputs
Lately, I have taken to the pattern of having a lot of diagnostic logging
I have an rails 3 application where there are multiple registrations (diagnosis, patient, laboratory
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css

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.