本文介绍了Easy DataServiceContext有问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我认为这很容易-我在C#客户端应用程序中使用DataServiceContext-如果发生异常(例如,在调用SaveChanges时),我可以调用客户端获取异常详细信息的任何功能吗? br/>
使用WP7客户端时,我注意到调试器似乎显示了更多信息-例如失败,因为属性X不能为空",
有什么想法吗?
在此先感谢!
Hi All,
I think this is an easy one - I am using a DataServiceContext in a C# client application - if there is an exception, for example when calling SaveChanges, is there any function I can call client-side to get the details of the exception?
when using a WP7 client I noticed the debugger seems to show more info - for example ''Failed because Property X cannot be null'',
Any ideas?
Thanks in advance!
推荐答案
[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]
有关更多信息,您还可以将以下内容添加到web.config文件中:
For further info you can also add the following to the web.config file:
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
这篇关于Easy DataServiceContext有问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!