<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>WCF</title>
        <link>http://geekswithblogs.net/sergun/category/9786.aspx</link>
        <description>WCF</description>
        <language>en-US</language>
        <copyright>Sergey Zwezdin</copyright>
        <managingEditor>sergey.zwezdin@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Debugging ADO.NET Data Services</title>
            <link>http://geekswithblogs.net/sergun/archive/2009/03/19/debugging-ado.net-data-services.aspx</link>
            <description>&lt;p&gt;Interest to ADO.NET Data Services platform obviously is growing up among developers of web-services. It also confirmed when I receive e-mail letters with questions about different problems. As a rule these questions are reduced to serivce error after some actions, when serivce say about general error and not takes details. In this case services say that he stored information about error in logs.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/sergun/WindowsLiveWriter/ADO.NETDataServices_11C4E/image_2.png"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title="image" border="0" alt="image" width="436" height="100" src="http://geekswithblogs.net/images/geekswithblogs_net/sergun/WindowsLiveWriter/ADO.NETDataServices_11C4E/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Whether familiarly to you the given message? I think yes, if you had time to try ADO.NET Data Services in practice.&lt;/p&gt;
&lt;p&gt;Really, ADO.NET Data Service not write any messages to log. If you need this behavior you should do it manually. What to do if you need to understand native problem of error?&lt;/p&gt;
&lt;p&gt;It’s very simple! You need to go to static method InitializeService,which initiate web-service. In this method passed parameter contains object which implements IDataServiceConfiguration.Last has property UseVerboseErrors. To get more information about error you should set this property to True.&lt;/p&gt;
&lt;div&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt; InitializeService(IDataServiceConfiguration config)&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;{&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;    config.SetEntitySetAccessRule(&lt;span style="COLOR: #006080"&gt;"*"&lt;/span&gt;, EntitySetRights.AllRead);&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;    config.UseVerboseErrors = &lt;span style="COLOR: #0000ff"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now we call web-service again and we see error details.&lt;/p&gt;
&lt;p&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title="image" border="0" alt="image" width="492" height="221" src="http://geekswithblogs.net/images/geekswithblogs_net/sergun/WindowsLiveWriter/ADO.NETDataServices_11C4E/image8.png" /&gt; &lt;/p&gt;
&lt;p&gt;Here we can already see some details and even Stack Trace! Often this information is enough. But in some cases this information has not enough. After simple operations in a reflector it is possible to understand, that all ADO.NET Data Services infrastructure is constructed over Windows Communcation Foundation, and is concrete WCF REST API. As you know, in the security goals WCF by default hides exception details. Though, we can override this behavior and explicit specify to WCF that he should show this information. In our case it more simply use ServiceBehavior attribute.&lt;/p&gt;
&lt;div&gt;
&lt;div style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;[ServiceBehavior(IncludeExceptionDetailInFaults = &lt;span style="COLOR: #0000ff"&gt;true&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt; WebDataService1 : DataService&amp;lt;MvcMiniCmsEntities&amp;gt;&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: white; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;{&lt;/pre&gt;
&lt;pre style="BORDER-BOTTOM-STYLE: none; PADDING-BOTTOM: 0px; LINE-HEIGHT: 12pt; BORDER-RIGHT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; MARGIN: 0em; PADDING-LEFT: 0px; WIDTH: 100%; PADDING-RIGHT: 0px; FONT-FAMILY: consolas, &amp;quot;Courier New&amp;quot;, courier, monospace; BORDER-TOP-STYLE: none; COLOR: black; FONT-SIZE: 8pt; BORDER-LEFT-STYLE: none; OVERFLOW: visible; PADDING-TOP: 0px"&gt;    //...&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now WCF infrastructure will be include exception details in response and you can understand why error is appears.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=130231"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=130231" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/sergun/aggbug/130231.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Sergey Zwezdin</dc:creator>
            <guid>http://geekswithblogs.net/sergun/archive/2009/03/19/debugging-ado.net-data-services.aspx</guid>
            <pubDate>Fri, 20 Mar 2009 03:14:20 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/sergun/comments/130231.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/sergun/archive/2009/03/19/debugging-ado.net-data-services.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/sergun/comments/commentRss/130231.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/sergun/services/trackbacks/130231.aspx</trackback:ping>
        </item>
    </channel>
</rss>