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

  • SEARCH
  • Home
  • 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 6243809
In Process

The Archive Base Latest Questions

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

For a service with webHttpBinding and helpEnabled=true, the help information is getting generated properly.

  • 0

For a service with webHttpBinding and helpEnabled=”true”, the help information is getting generated properly. Was wondering if it is possible to control the output somehow. Below are the changes I would like to make.

  1. Remove the JSON help as the service doesn’t support JSON output. Having it there might be confusing to users. At least, have a way to output a note saying JSON is not supported.
  2. For the example replies shown, use a better example than “String content” where actual value samples can be specified. Would be good if I can supply the object that is used for being serialized as example.
  • 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:12:37+00:00Added an answer on May 24, 2026 at 12:12 pm

    The help page for WCF WebHttp endpoints cannot be customized. You can, however, replace it with your own custom page. It’s easy to be implemented, but it’s a lot of code to write. The example below shows how this can be done for a simple service.

    public class StackOverflow_7005187
    {
        [DataContract]
        public class MyDC
        {
            [DataMember]
            public string str = "The string";
        }
        [ServiceContract]
        public interface ITest
        {
            [WebInvoke]
            string EchoString(string text);
            [WebGet]
            int Add(int x, int y);
            [WebInvoke]
            MyDC EchoDC(MyDC input);
            [WebGet(UriTemplate = "/help")]
            Message GetMainHelpPage();
            [WebGet(UriTemplate = "/help/operations/EchoDC")]
            Message GetOperationsEchoDCHelpPage();
            // help for other operations not implemented
        }
        public class Service : ITest
        {
            public string EchoString(string text)
            {
                return text;
            }
    
            public int Add(int x, int y)
            {
                return x + y;
            }
    
            public MyDC EchoDC(MyDC input)
            {
                return input;
            }
    
            public Message GetMainHelpPage()
            {
                string page = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
    <html xmlns=""http://www.w3.org/1999/xhtml"">
      <head>
        <title>Operations at http://localhost:8000/Service</title>
        <style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>
      </head>
      <body>
        <div id=""content"">
          <p class=""heading1"">Operations at http://localhost:8000/Service</p>
          <p>This page describes the service operations at this endpoint.</p>
          <table>
            <tr>
              <th>Uri</th>
              <th>Method</th>
              <th>Description</th>
            </tr>
            <tr>
              <td>Add</td>
              <td title=""http://localhost:8000/Service/Add?x={X}&amp;y={Y}"">
                <a rel=""operation"" href=""help/operations/Add"">GET</a>
              </td>
              <td>Service at http://localhost:8000/Service/Add?x={X}&amp;y={Y}</td>
            </tr>
            <tr>
              <td>EchoDC</td>
              <td title=""http://localhost:8000/Service/EchoDC"">
                <a rel=""operation"" href=""help/operations/EchoDC"">POST</a>
              </td>
              <td>Service at http://localhost:8000/Service/EchoDC</td>
            </tr>
            <tr>
              <td>EchoString</td>
              <td title=""http://localhost:8000/Service/EchoString"">
                <a rel=""operation"" href=""help/operations/EchoString"">POST</a>
              </td>
              <td>Service at http://localhost:8000/Service/EchoString</td>
            </tr>
          </table>
        </div>
      </body>
    </html>";
                return WebOperationContext.Current.CreateStreamResponse(
                    new MemoryStream(Encoding.UTF8.GetBytes(page)),
                    "text/html");
            }
    
    
            public Message GetOperationsEchoDCHelpPage()
            {
                string page = @"<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
    <html xmlns=""http://www.w3.org/1999/xhtml"">
      <head>
        <title>Reference for  http://localhost:8000/Service/EchoDC</title>
        <style>BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; } #content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; } A:link { color: #336699; font-weight: bold; text-decoration: underline; } A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; } A:active { color: #336699; font-weight: bold; text-decoration: underline; } .heading1 { background-color: #003366; border-bottom: #336699 6px solid; color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal;margin: 0em 0em 10px -20px; padding-bottom: 8px; padding-left: 30px;padding-top: 16px;} pre { font-size:small; background-color: #e5e5cc; padding: 5px; font-family: Courier New; margin-top: 0px; border: 1px #f0f0e0 solid; white-space: pre-wrap; white-space: -pre-wrap; word-wrap: break-word; } table { border-collapse: collapse; border-spacing: 0px; font-family: Verdana;} table th { border-right: 2px white solid; border-bottom: 2px white solid; font-weight: bold; background-color: #cecf9c;} table td { border-right: 2px white solid; border-bottom: 2px white solid; background-color: #e5e5cc;}</style>
      </head>
      <body>
        <div id=""content"">
          <p class=""heading1"">Reference for  http://localhost:8000/Service/EchoDC</p>
          <p></p>
          <p xmlns=""http://www.w3.org/1999/xhtml"">
            <b>Url: </b>
            <span class=""uri-template"">http://localhost:8000/Service/EchoDC</span>
          </p>
          <p xmlns=""http://www.w3.org/1999/xhtml"">
            <b>HTTP Method: </b>
            <span class=""method"">POST</span>
          </p>
          <table>
            <tr>
              <th>Message direction</th>
              <th>Format</th>
              <th>Body</th>
            </tr>
            <tr>
              <td>Request</td>
              <td>Xml</td>
              <td>
                <a href=""#request-xml"">Example</a></td>
            </tr>
            <tr>
              <td>Request</td>
              <td>Json</td>
              <td>
                <a href=""#request-json"">Example</a>
              </td>
            </tr>
            <tr>
              <td>Response</td>
              <td>Xml</td>
              <td>
                <a href=""#response-xml"">Example</a></td>
            </tr>
          </table>
          <p>
            <a name=""#request-xml"">The following is an example request Xml body:</a>
            <pre class=""request-xml"">&lt;StackOverflow_7005187.MyDC xmlns=""http://schemas.datacontract.org/2004/07/WcfForums""&gt;
      &lt;str&gt;This is a modified string content&lt;/str&gt;
    &lt;/StackOverflow_7005187.MyDC&gt;</pre>
          </p>
          <p>
            <a name=""#request-json"">The following is an example request Json body:</a>
            <pre class=""request-json"">{
        ""str"":""Some content in JSON""
    }</pre>
          </p>
          <p>
            <a name=""#response-xml"">The following is an example response Xml body:</a>
            <pre class=""response-xml"">&lt;StackOverflow_7005187.MyDC xmlns=""http://schemas.datacontract.org/2004/07/WcfForums""&gt;
      &lt;str&gt;Another modified XML content&lt;/str&gt;
    &lt;/StackOverflow_7005187.MyDC&gt;</pre>
          </p>
        </div>
      </body>
    </html>";
                return WebOperationContext.Current.CreateStreamResponse(
                    new MemoryStream(Encoding.UTF8.GetBytes(page)),
                    "text/html");
            }
        }
        public static void Test()
        {
            string baseAddress = "http://" + Environment.MachineName + ":8000/Service";
            ServiceHost host = new ServiceHost(typeof(Service), new Uri(baseAddress));
            host.AddServiceEndpoint(typeof(ITest), new WebHttpBinding(), "").Behaviors.Add(new WebHttpBehavior { HelpEnabled = false });
            host.Open();
            Console.WriteLine("Host opened");
    
            Console.Write("Press ENTER to close the host");
            Console.ReadLine();
            host.Close();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service which would like to support basicHttpBinding and webHttpBinding. When
How we could authenticate/authorize WCF RESTful service (that uses webHttpBinding (and not wsHttpBinding, like
is it possible to call a service operation at a wcf endpoint uri with
I have a service called myService.svc. This service is exposed using a webHttpBinding binding.
Setting up a WCF service that uses the webHttpBinding... I can return complex types
I have a REST WCF service. Its using a webHttpBinding and the configuration looks
I have a WCF service that has webHttpBinding and has enableWebScript turned on in
I have a WCF service that is using webHttpBinding on an endpoint, and the
I have a IIS hosted WCF service that is configured with a WebHttpBinding. It
I have a WCF Service that exposes two endpoints. One with a WebHttpBinding (acting

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.