Wcf 如果我没有';“我没有一个”&书信电报;行为>&引用;我的Web.Config中的节点?

Wcf 如果我没有';“我没有一个”&书信电报;行为>&引用;我的Web.Config中的节点?,wcf,web-config,Wcf,Web Config,在测试WCF Web服务时,是否看到可怕的请求错误 好吧,不用担心,因为这个StackOverflow答案向您展示了如何打开详细的错误显示: 但是。。。等等,我们没有一个Web.Config看起来像那样 我们只有一个系统。serviceModel,就是这样 <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEn

在测试WCF Web服务时,是否看到可怕的请求错误

好吧,不用担心,因为这个StackOverflow答案向您展示了如何打开详细的错误显示:

但是。。。等等,我们没有一个Web.Config看起来像那样

我们只有一个
系统。serviceModel
,就是这样

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
    <standardEndpoints>
        <webHttpEndpoint>
            <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
        </webHttpEndpoint>
    </standardEndpoints>
</system.serviceModel>
但我得到一个服务器错误:

分析器错误消息:无法识别的属性“behaviorConfiguration”。 请注意,属性名称区分大小写


行为
必须在标签
系统中。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>

感谢克里斯和燃烧军团为我们指明了方向。这就是我最终得到的
system.serviceModel
,它成功地显示了错误细节

这是根据@burning_LEGION的答案,但行为上没有name属性:

  <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>


谢谢,我刚做完。这确实消除了解析器/配置错误-因此至少web.config再次有效。但它并不是在显示任何异常细节。我回到了可怕的请求错误屏幕,没有任何细节。使用behaviorConfiguration来识别要应用于端点的行为-因此添加behaviorConfiguration=“DataServiceBehavior”(来自上面的示例)@Chris yep这就是我得到的。与burning_Legion发布的15行XML相同。但没有例外的细节,只是请求Error@hawbsl,Chris谈到用这个代替endpoin,谢谢,现在我明白了。我已经做出了改变。但它仍然不快乐。看到我的编辑。太好了-谢谢你,只是把它放在没有名字的相同行为中也让我得到了错误详细信息:)
<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>
  <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>