Last post Jun 25, 2010 10:51 PM by MWeber
May 27, 2010 12:29 AM|MWeber|LINK
I am using "WebServiceHost". I know that with "WebServiceHost2" I can disable the help page using "MyServiceHost.EnableAutomaticHelpPage = False".
I cannot figure out how to do it with "WebServiceHost".
Note, I have tried using "<serviceDebug httpHelpPageEnabled="false"" in the web.config as well. It seems like this type of host just has a mind of its own.
I am going to post my code because I create the host in the code, not the web.config. If you know how to turn off the help page in the code please let me know. It would be greatly appreciated.
Here is the code:
Jun 06, 2010 12:11 PM|derianto|LINK
To clarify, are you trying to disable help page in the base address? To do it via code, you can do
((ServiceDebugBehavior)webServiceHost.Description.Behaviors[typeof(ServiceDebugBehavior)]).HttpHelpPageEnabled = false;
If you're taking about disabling REST help page (the one with /help path in it) programmatically, you can do
((WebHttpBehavior)webServiceHost.Description.Endpoints[i].Behaviors[typeof(WebHttpBehavior)]).HelpEnabled = false;
Hope this helps,
Jun 07, 2010 01:17 PM|MWeber|LINK
Thank you so much for your reply.
I am trying to disable the rest help page. Unfortunately, when I tried the code it produces the error.
'HelpEnabled' is not a member of 'System.ServiceModel.Description.WebHttpBehavior'
Based on your reply I did some research and found the following:
"As of WCF 4, the WebHttpBehavior class comes with a HelpEnabled property that controls whether or not the new help page is enabled within the host"
So my guess is that I do not have WCF 4 and installing that will make the code work. So that is some good news. However, I was wondering if you know the code to turn it off without WCF 4?
Jun 25, 2010 05:31 PM|MWeber|LINK
Well, I finally got VS 2010 and tried the code above. There is no longer any sytax error so I assume the code is legit. However, the help page still shows up. I think I have read and tried everything, but it will not go away. I do not know why it is
so difficult to get rid of the help page. Please let me know if you have any ideas. Here is the page I get that I want to get rid of:
Error Description: 'Resource does not exist'
This may be because an invalid URI or HTTP method was specified. Please see the service help page for constructing valid requests to the service.
Jun 25, 2010 10:51 PM|MWeber|LINK
If you use ServiceHost then you can disable the "/help" page. However, if you use
WebServiceHost it is impossible. I should have known that is was some WCF BS and not my fault.
It gets even better.
If you use ServiceHost and turn off the help page you get an ugly page telling you to enable discovery. Not much improvement! Do some research you may find a promising feature called "HttpHelpPageUrl". Well, do not get your hopes up. If you specifiy
the "HttpHelpPageUrl" it will go back to the other page that says "Error Description: 'Resource does not exist'".
There is no way to win with WCF configuration.
The bottom line is these configuration options are useless. Show me one person that ever got "HttpHelpPageUrl" to work. The more I read people's disparaging posts on forums, the more I realize that "HttpHelpPageUrl" does not work and you cannot have your
own help page.