在测试WCF Web服务时看到可怕的" 请求错误"页面?
好吧,不用担心,因为这个StackOverflow答案显示了如何打开详细的错误显示:WCF数据服务 - 如何诊断请求错误?
但是...... 坚持下去,我们没有看起来像那个的Web.Config.
我们只有一个system.serviceModel
就是这样.
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"></standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)
如果我们去,只需添加以下内容:
<behaviors>
<serviceBehaviors>
<behavior name="DataServiceBehavior">
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)
到最后,然后男孩不开心:
根据@burning_LEGION和@Chris(见下文)的答案和评论,我现在Web.Config
看起来像这样:
<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>
Run Code Online (Sandbox Code Playgroud)
但我收到服务器错误:
分析器错误消息:无法识别的属性"behaviorConfiguration".请注意,属性名称区分大小写.
感谢Chris和burning_Legion指出了方向.这是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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3313 次 |
最近记录: |