4

Seeing the dreaded Request Error page while testing your WCF Web Service?

enter image description here

Well, worry not, because this StackOverflow answer shows you how to turn on detailed error display: WCF Data Service - How To Diagnose Request Error?

But ... hang on, we don't have a Web.Config that looks anything like that one.

Ours just has a system.serviceModel and that's it.

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
    <standardEndpoints>
        <webHttpEndpoint>
            <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
        </webHttpEndpoint>
    </standardEndpoints>
</system.serviceModel>

If we go for it and simply add the following:

<behaviors>
    <serviceBehaviors>
        <behavior name="DataServiceBehavior">
            <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
    </serviceBehaviors>
</behaviors>

on to the end, then boy is it unhappy:

enter image description here

Update/Edit

Based on answers and comments from @burning_LEGION and @Chris (see below) I now have a Web.Config which looks like this:

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
      <standardEndpoints>
    <webHttpEndpoint>
          <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" behaviorConfiguration="DataServiceBehavior"></standardEndpoint>
    </webHttpEndpoint>
      </standardEndpoints>

      <behaviors>
    <serviceBehaviors>
      <behavior name="DataServiceBehavior">
        <serviceDebug includeExceptionDetailInFaults="true"/>
      </behavior>
    </serviceBehaviors>
      </behaviors>
  </system.serviceModel>

But I'm getting a Server Error:

Parser Error Message: Unrecognized attribute 'behaviorConfiguration'. Note that attribute names are case-sensitive.

Community
  • 1
  • 1
hawbsl
  • 15,313
  • 25
  • 73
  • 114

2 Answers2

5

Thanks to Chris and burning_Legion for pointing the way. This was the system.serviceModel which I eventually ended up with and which successfully shows the error detail.

It's per @burning_LEGION's answer but without the name attribute on the behavior:

  <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
      <standardEndpoints>
    <webHttpEndpoint>
          <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
    </webHttpEndpoint>
      </standardEndpoints>

    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

  </system.serviceModel>
hawbsl
  • 15,313
  • 25
  • 73
  • 114
3

behaviors must be in tag system.serviceModel

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
    <standardEndpoints>
        <webHttpEndpoint>
            <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
        </webHttpEndpoint>
    </standardEndpoints>   
    <behaviors>
       <serviceBehaviors>
           <behavior name="DataServiceBehavior">
              <serviceDebug includeExceptionDetailInFaults="true"/>
           </behavior>
       </serviceBehaviors>
    </behaviors> 
</system.serviceModel>
burning_LEGION
  • 13,246
  • 8
  • 40
  • 52
  • thanks, so i've just done that. that *does* get rid of the Parser/Configuration error - so at least the web.config is valid again. but it's not like it's dispalying any exception details. I'm back to just the dreaded *Request Error* screen with no detail. – hawbsl Aug 09 '12 at 08:29
  • use behaviorConfiguration to identify the behavior to apply to your endpoint - so add behaviorConfiguration="DataServiceBehavior" (from the above example) – Chris Aug 09 '12 at 08:40
  • @Chris yep that's what i've got. the same 15 lines of XML that burning_Legion posted. but no exception detail, just _Request Error_ – hawbsl Aug 09 '12 at 08:47
  • @hawbsl, Chris talk about replacing endpoin with this – burning_LEGION Aug 09 '12 at 08:50
  • thanks, now i understand. and i've made that change. but it's still not happy. see my edit. – hawbsl Aug 09 '12 at 08:57
  • class `WebHttpEndpoint` have tag behavior, try use it, http://msdn.microsoft.com/en-us/library/system.servicemodel.description.webhttpendpoint.aspx – burning_LEGION Aug 09 '12 at 09:07
  • got a slightly different web.config to work and posted it as accepted answer. +1 and thanks to you guys. – hawbsl Aug 09 '12 at 09:36