<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Silverlight Web Services Team : debugging</title><link>http://blogs.msdn.com/silverlightws/archive/tags/debugging/default.aspx</link><description>Tags: debugging</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Some known issues in SL3 Beta</title><link>http://blogs.msdn.com/silverlightws/archive/2009/04/05/some-known-issues-in-sl3-beta.aspx</link><pubDate>Mon, 06 Apr 2009 08:21:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9534200</guid><dc:creator>SLWSTeam</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/silverlightws/comments/9534200.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlightws/commentrss.aspx?PostID=9534200</wfw:commentRss><description>&lt;P&gt;We've run across some issues with our web services features in the Silverlight 3 Beta and I want to share these here to hopefully save folks some time and frustration.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt; On Windows 7 Beta, you might encounter the following error when generating a proxy: "The element 'httpTransport' cannot contain child element 'extendedProtectionPolicy' because the parent element's content model is empty".&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Workaround:&lt;/STRONG&gt; On Windows 7, when you use the &lt;STRONG&gt;Silverlight-enabled WCF Service&lt;/STRONG&gt; item template, an &amp;lt;extendedProtectionPolicy /&amp;gt; element may be generated in Web.config. This element is not supported by Silverlight. Simply remove the element from Web.config and try regenerating the Silverlight proxy.&lt;/P&gt;
&lt;HR&gt;

&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Issue: &lt;/STRONG&gt;If you use the &lt;STRONG&gt;Silverlight-enabled WCF Service&lt;/STRONG&gt; template and you try generating a Silverlight proxy using &lt;STRONG&gt;Add Service Reference&lt;/STRONG&gt; on a machine with &lt;U&gt;both&lt;/U&gt; Silverlight 2 and Silverlight 3 Beta SDKs, you may get warnings at proxy generation time and errors at runtime. The warnings can include a variety of "Cusom tool" warnings which state that the endpoints found are "not compatible with Silverlight 2" or "No endpoints compatible with Silverlight 2 were found."&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Workaround:&lt;/STRONG&gt; If you are using &lt;STRONG&gt;Add Service Reference &lt;/STRONG&gt;to generate proxies, side-by-side installation of the Silverlight 2 and Silverlight 3 Beta SDKs is not supported. Please uninstall the Silverlight 2 SDK to use Silverlight 3 features. After uninstalling, ensure that the assembly Microsoft.Silverlight.ServiceReference is &lt;U&gt;not&lt;/U&gt; present in the machine GAC. &lt;/P&gt;
&lt;HR&gt;

&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Issue:&lt;/STRONG&gt; When using &lt;STRONG&gt;Add Service Reference&lt;/STRONG&gt; to generate a proxy to a WCF duplex service (a service built with the System.ServiceModel.PollingDuplex.dll assembly provided in the Silverlight SDK), the generated proxy may not compile and may complain about a missing assembly reference.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Workaround: &lt;/STRONG&gt;The proxy for the duplex service is generated correctly, however &lt;STRONG&gt;Add Service Reference &lt;/STRONG&gt;will sometimes forget to reference th &lt;STRONG&gt;System.ServiceModel.PollingDuplex.dll &lt;/STRONG&gt;assembly in the Silverlight client. Simply add a reference to the assembly (right-click in the Silverlight project, select &lt;STRONG&gt;Add Reference&lt;/STRONG&gt;, find the assembly in the list on the &lt;STRONG&gt;.Net&lt;/STRONG&gt; tab), and the proxy should now compile.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Hope this is helpful!&lt;BR&gt;-Yavor Georgiev&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9534200" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlightws/archive/tags/debugging/default.aspx">debugging</category><category domain="http://blogs.msdn.com/silverlightws/archive/tags/duplex/default.aspx">duplex</category><category domain="http://blogs.msdn.com/silverlightws/archive/tags/tools/default.aspx">tools</category><category domain="http://blogs.msdn.com/silverlightws/archive/tags/bugs/default.aspx">bugs</category></item><item><title>Debugging Web Service Usage in Silverlight 2</title><link>http://blogs.msdn.com/silverlightws/archive/2008/04/16/debugging-web-service-usage-in-silverlight-2.aspx</link><pubDate>Wed, 16 Apr 2008 21:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8399338</guid><dc:creator>SLWSTeam</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/silverlightws/comments/8399338.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlightws/commentrss.aspx?PostID=8399338</wfw:commentRss><description>&lt;P&gt;(Cross-posted from &lt;A href="http://eugeneos.blogspot.com/2008/04/debugging-web-service-usage-in.html"&gt;http://eugeneos.blogspot.com/2008/04/debugging-web-service-usage-in.html&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Silverlight 2 Beta1 makes it easy to use Web Services based on either the WCF technology (Windows Communication Foundation), the “.asmx” technology (ASP.NET Web Services), or practically any other SOAP platform. &lt;/P&gt;
&lt;P&gt;Unfortunately, when something goes wrong with service consumption, you often run into cryptic and incomprehensible error messages that don’t help you much. We are looking into various ways to make this better by the time we fully ship Silverlight 2, but for now I hope that this post will be useful in helping you debug common problems. Here are the things you can try:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;Does your proxy compile?&lt;/SPAN&gt;&lt;/U&gt; &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;After you use the “Add Service Reference” dialog to add a reference to a service, try building your project. If you get compilation issues in the generated proxy code, you are probably using a service that uses some feature that is not supported in Beta1. We are trying to fix all or most of these by the time we ship, but for now the easiest thing to do is to find the offending code in the generated proxy and just remove it – naturally this workaround does not work in all cases :) Some common things that will cause non-compilable proxies in Beta1: &lt;/P&gt;
&lt;P&gt;- Using custom SOAP headers in your service &lt;BR&gt;- Using custom SOAP faults &lt;BR&gt;- Using “wildcard” schema in your service like &lt;STRONG&gt;xsd:any&lt;/STRONG&gt; or &lt;STRONG&gt;xsd:anyattribute&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;And specifically if your service is a WCF (or in some cases .ASMX) service: &lt;/P&gt;
&lt;P&gt;- Using XML types like XmlElement/XElement/XmlNode[]/XmlAttribute/etc. in your service &lt;BR&gt;- Using Datasets in your service &lt;BR&gt;- Using types that implement ISerializable in your service (except for collections) &lt;BR&gt;- Using WCF Transactions features &lt;BR&gt;- Using the Stream type in your service &lt;BR&gt;- Using MessageHeaderAttribute in Message Contracts &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;Check the Configuration&lt;/SPAN&gt;&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;The next step is to check whether the service is configured correctly. You should have a file called &lt;STRONG&gt;&lt;EM&gt;ServiceReferences.ClientConfig &lt;/EM&gt;&lt;/STRONG&gt;generated by Add Service Reference. It actually doesn’t do anything at all in Beta1! This (understandably) confuses a lot of people. Starting with Beta2, we will actually start using this file, but for now any changes that you’ll make in it won’t actually affect anything. &lt;/P&gt;
&lt;P&gt;However, the file is still useful for debugging. Look in the file – it should look something like this: &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: #000099"&gt;&amp;lt;configuration&amp;gt;&lt;BR&gt;&amp;lt;system.serviceModel&amp;gt; &lt;BR&gt;&amp;lt;client&amp;gt; &lt;BR&gt;&lt;STRONG&gt;&amp;lt;endpoint address="&lt;SPAN style="COLOR: #990000"&gt;http://localhost:5678/TestService.svc&lt;/SPAN&gt;" binding="&lt;SPAN style="COLOR: #990000"&gt;basicHttpBinding&lt;/SPAN&gt;" contract="MyProject.ITestService" name="default" /&amp;gt; &lt;BR&gt;&lt;/STRONG&gt;&amp;lt;/client&amp;gt; &lt;BR&gt;&amp;lt;/system.serviceModel&amp;gt; &lt;BR&gt;&amp;lt;/configuration&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: #000099"&gt;&lt;SPAN style="FONT-FAMILY: Courier New"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;Notice that it has exactly one &lt;STRONG&gt;&lt;EM&gt;endpoint&lt;/EM&gt;&lt;/STRONG&gt; element for the service you just added a reference to, and the binding is basicHttpBinding. &lt;/P&gt;
&lt;P&gt;If you don’t see an &lt;STRONG&gt;&lt;EM&gt;endpoint&lt;/EM&gt;&lt;/STRONG&gt; element for your service, chances are your service wasn’t actually configured correctly for Silverlight consumption. Silverlight can only talk to simple SOAP services at this point – only SOAP 1.1, without any advanced WS-* protocols like WS-Addressing or WS-Security. If you are using “.ASMX” web services, they should just default to this simple configuration. If you are using WCF services, you need to check the configuration on the service side. Open &lt;STRONG&gt;&lt;EM&gt;web.config &lt;/EM&gt;&lt;/STRONG&gt;in your service-side project and find a place that looks like the following (usually towards the end): &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="COLOR: #000099"&gt;&amp;lt;system.serviceModel&amp;gt; &lt;BR&gt;... &lt;BR&gt;&amp;lt;services&amp;gt; &lt;BR&gt;&amp;lt;service name="MyProject.TestService"&amp;gt; &lt;BR&gt;&lt;STRONG&gt;&amp;lt;endpoint address="" binding="&lt;SPAN style="COLOR: #990000"&gt;basicHttpBinding&lt;/SPAN&gt;" contract="&lt;SPAN style="COLOR: #990000"&gt;MyProject.ITestService&lt;/SPAN&gt;" /&amp;gt; &lt;BR&gt;&lt;/STRONG&gt;&amp;lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&amp;gt; &lt;BR&gt;... &lt;BR&gt;&amp;lt;/service&amp;gt; &lt;BR&gt;&amp;lt;/services&amp;gt; &lt;BR&gt;&amp;lt;/system.serviceModel&amp;gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;Find the &lt;STRONG&gt;&lt;EM&gt;endpoint&lt;/EM&gt;&lt;/STRONG&gt; whose “contract” attribute refers to your service. Make sure that the “binding” attribute is set to “basicHttpBinding”. Unfortunately the default for WCF is “wsHttpBinding”, but it doesn’t work with Silverlight. We are hoping to ship a Visual Studio item template in the future (“Add New Item… Silverlight-enabled WCF Service”) that will have a number of Silverlight-friendly defaults, including the correct binding. &lt;/P&gt;
&lt;P&gt;It is ok to have other &lt;STRONG&gt;&lt;EM&gt;endpoint&lt;/EM&gt;&lt;/STRONG&gt; elements for other contracts with other bindings - for example, do not change the "mexHttpBinding" in the second &lt;STRONG&gt;&lt;EM&gt;endpoint&lt;/EM&gt;&lt;/STRONG&gt; element above. &lt;/P&gt;
&lt;P&gt;You should check your service-side configuration even if the client-side &lt;STRONG&gt;&lt;EM&gt;ServiceReferences.ClientConfig &lt;/EM&gt;&lt;/STRONG&gt;appears to be correct. &lt;/P&gt;
&lt;P&gt;If &lt;STRONG&gt;&lt;EM&gt;ServiceReferences.ClientConfig &lt;/EM&gt;&lt;/STRONG&gt;contains more than one &lt;STRONG&gt;&lt;EM&gt;endpoint&lt;/EM&gt;&lt;/STRONG&gt; for your service, you may need to use a more complicated constructor to new up your service proxy – the one that takes a Binding and an EndpointAddress. Not to worry – just pass a new BasicHttpBinding() and a new EndpointAddress built from the URL of your service. &lt;/P&gt;
&lt;P&gt;By the way, our long-term (post-Beta1) plans for the config file are described here: &lt;A href="http://blogs.msdn.com/suwatch/archive/2008/04/07/tutorial-using-silverlight-web-service-client-configuration.aspx" mce_href="http://blogs.msdn.com/suwatch/archive/2008/04/07/tutorial-using-silverlight-web-service-client-configuration.aspx"&gt;http://blogs.msdn.com/suwatch/archive/2008/04/07/tutorial-using-silverlight-web-service-client-configuration.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;Check if the Service is Running&lt;/SPAN&gt;&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;Before looking for problems on the Silverlight side, it is useful to first check whether the service itself is working. A quick-and-dirty way to check is to just type the service address into a web browser (not the address you typed into the “Add Service Reference” dialog, but the address you can find in &lt;STRONG&gt;&lt;EM&gt;ServiceReferences.ClientConfig&lt;/EM&gt;&lt;/STRONG&gt;). In many cases, the “service help page” feature will be turned on and you will see either a page indicating that the service is running, or an error page which you can use as a starting point for debugging. &lt;/P&gt;
&lt;P&gt;A more reliable way to test whether the service is working is to use a test tool such as the WCF Test Client (&lt;A href="http://msdn2.microsoft.com/en-us/library/bb552364.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb552364.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb552364.aspx&lt;/A&gt;) to try and talk to the service. &lt;/P&gt;
&lt;P&gt;Finally, an almost sure-fire but sometimes lengthy way of finding out whether the problem is with the Silverlight code or with the service code is to try using the service without Silverlight :) Just create a new project of type “Console Application”, do an Add Service Reference to that project just like in Silverlight, and write service consumption code inside Main() – again, just like in Silverlight. Use Console.WriteLine to show the results. &lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;Check for Cross-Domain Issues&lt;/SPAN&gt;&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;Start your Silverlight application. Note the URL that appears in the browser (e.g. &lt;STRONG&gt;http://localhost:1111/something/MyGraphicalApp.aspx&lt;/STRONG&gt;) – this is your “Application URL”. (Actually, what matters here is the URL of the XAP file, e.g. &lt;STRONG&gt;http://localhost:1111/somethingelse/MyGraphicalApp.xap&lt;/STRONG&gt;, but in most simple cases this URL would be in the same domain as the hosting web page, so I’m ignoring the difference for now). Then, look at the URL in the ServiceReferences.ClientConfig file – e.g. &lt;STRONG&gt;http://localhost:5678/foo/TestService.svc &lt;/STRONG&gt;or &lt;STRONG&gt;local.live.com/SearchService/LocalSearch.asmx&lt;/STRONG&gt; - this is your “Service URL”. &lt;/P&gt;
&lt;P&gt;In Beta1, both the “Application URL” and the “Service URL” must be HTTP URLs (not HTTPS) for service consumption to work. This is the first thing to check. &lt;/P&gt;
&lt;P&gt;Also, a common mistake is to run your Silverlight application from a &lt;STRONG&gt;file:// &lt;/STRONG&gt;Application URL, resulting in cross-domain issues. Sometimes, you run into this if you just hit F5 to run your Silverlight app – instead, right-click on the .aspx page in your project and choose “View in Browser”. &lt;/P&gt;
&lt;P&gt;Now you need to figure out the domains for these URLs. The domain is just the basically everything between &lt;STRONG&gt;http:// &lt;/STRONG&gt;and the first slash &lt;STRONG&gt;/ &lt;/STRONG&gt;after that, including the port number (assumed to be 80 if not present). If the domain of the Application URL is different in any way from the domain of the Service URL in any way (even if it’s just a port number difference, or just one part of the domain name is different), you have a cross-domain situation. For example, if your app is at &lt;STRONG&gt;http://localhost:1111/something/MyGraphicalApp.aspx &lt;/STRONG&gt;and it is trying to call into &lt;STRONG&gt;http://localhost:5678/foo/TestService.svc&lt;/STRONG&gt;, you have a cross-domain situation because &lt;STRONG&gt;localhost:1111 &lt;/STRONG&gt;is different from &lt;STRONG&gt;localhost:5678&lt;/STRONG&gt;. &lt;/P&gt;
&lt;P&gt;Silverlight documentation tells you that if you are in a cross-domain situation, you need to have a “cross-domain policy file” (&lt;STRONG&gt;&lt;EM&gt;clientaccesspolicy.xml &lt;/EM&gt;&lt;/STRONG&gt;or &lt;STRONG&gt;&lt;EM&gt;crossdomain.xml&lt;/EM&gt;&lt;/STRONG&gt;) present if you want services to work. There is an easy way to check if you have everything set up correctly: Just open a browser and browse to &lt;STRONG&gt;http://&lt;/STRONG&gt;&lt;EM&gt;service_domain&lt;/EM&gt;&lt;STRONG&gt;/clientaccesspolicy.xml &lt;/STRONG&gt;and &lt;STRONG&gt;http://&lt;/STRONG&gt;&lt;EM&gt;service_domain&lt;/EM&gt;&lt;STRONG&gt;/crossdomain.xml&lt;/STRONG&gt;. If at least one of these is present, valid and allows cross-domain access – you’re fine. If not, you need to make sure at least one of these files is present. &lt;/P&gt;
&lt;P&gt;A common mistake is to put the cross-domain policy file not directly at the root of the domain – for example, at &lt;STRONG&gt;http://localhost:5678/foo/clientaccesspolicy.xml &lt;/STRONG&gt;instead of at &lt;STRONG&gt;http://localhost:5678/clientaccesspolicy.xml&lt;/STRONG&gt;. It is easy to run into this situation when working with older (.NET 2.0) projects – see &lt;A href="http://timheuer.com/blog/archive/2008/04/09/silverlight-cannot-access-web-service.aspx" mce_href="http://timheuer.com/blog/archive/2008/04/09/silverlight-cannot-access-web-service.aspx"&gt;http://timheuer.com/blog/archive/2008/04/09/silverlight-cannot-access-web-service.aspx&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;Also, make sure to check the syntax of these files – an error in parsing will be treated essentially the same way as if the file was not there. Also note that &lt;STRONG&gt;&lt;EM&gt;clientaccesspolicy.xml &lt;/EM&gt;&lt;/STRONG&gt;and &lt;STRONG&gt;&lt;EM&gt;crossdomain.xml &lt;/EM&gt;&lt;/STRONG&gt;have different syntax – make sure you use the appropriate content for the file you choose. &lt;/P&gt;
&lt;P&gt;A neat trick for adding cross-domain policy files to WCF services that are not hosted in IIS is described here: &lt;A href="http://blogs.msdn.com/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx" mce_href="http://blogs.msdn.com/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx"&gt;http://blogs.msdn.com/carlosfigueira/archive/2008/03/07/enabling-cross-domain-calls-for-silverlight-apps-on-self-hosted-web-services.aspx&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;Enable Exceptions&lt;/SPAN&gt;&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;Normally, Silverlight does not give you much information in exception messages. This decision was made to make the Silverlight download size smaller (exceptions take up a lot of space, especially once they’re translated into all of the languages Silverlight supports). You can read more about this, and find out how to turn on full exceptions for debugging, here: &lt;A href="http://blogs.msdn.com/silverlightws/archive/2008/04/06/getting-full-exceptions-in-silverlight-2-beta-1.aspx" mce_href="http://blogs.msdn.com/silverlightws/archive/2008/04/06/getting-full-exceptions-in-silverlight-2-beta-1.aspx"&gt;http://blogs.msdn.com/silverlightws/archive/2008/04/06/getting-full-exceptions-in-silverlight-2-beta-1.aspx&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Also, if you are using a WCF service, WCF does not normally return much information about server-side exceptions. This is a security measure: you normally don’t want to expose internal information about your service to the outside world. However, during debugging, you can change this by following the steps here: &lt;A href="http://blogs.devdeo.com/carlos.medina/PermaLink,guid,b3bff742-0ec9-4f5c-a178-625220a46652.aspx" mce_href="http://blogs.devdeo.com/carlos.medina/PermaLink,guid,b3bff742-0ec9-4f5c-a178-625220a46652.aspx"&gt;http://blogs.devdeo.com/carlos.medina/PermaLink,guid,b3bff742-0ec9-4f5c-a178-625220a46652.aspx&lt;/A&gt;. Make sure to turn it off once you’re done debugging! &lt;/P&gt;
&lt;P&gt;Finally, this seems obvious but a lot of people forget about it for some reason - when you get an exception, don’t just look at the exception itself - look at its innerException, and the innerException inside it, etc. Especially in web service scenarios, the truly useful exceptions are often “wrapped” in several layers. &lt;/P&gt;
&lt;P&gt;Unfortunately, even with all of the steps above, you often still won’t see much useful information when a web service call fails. This is due to a pretty fundamental limitation of Silverlight Beta1 (that unfortunately may stay around even after the Beta) – the lack of support for SOAP Faults. So, to truly debug, you need to see what is actually going on – this is what the next section is about. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;&lt;SPAN style="FONT-SIZE: 130%"&gt;Getting Down to the Wire&lt;/SPAN&gt;&lt;/U&gt;&lt;/STRONG&gt; &lt;/P&gt;
&lt;P&gt;The ultimate way to debug Silverlight service consumption issues is by using an “HTTP spying” tool such as &lt;A href="http://www.fiddlertool.com/fiddler/" mce_href="http://www.fiddlertool.com/fiddler/"&gt;http://www.fiddlertool.com/fiddler/&lt;/A&gt; or &lt;A href="http://projects.nikhilk.net/webdevhelper/" mce_href="http://projects.nikhilk.net/webdevhelper/"&gt;http://projects.nikhilk.net/webdevhelper/&lt;/A&gt; that shows you the actual HTTP traffic as it happens. Before using it, make sure to enable server-side exceptions (see above). Start your Silverlight app and your tool side-by-side, and make your app do a web service call. Here are some common patterns you will see: &lt;/P&gt;
&lt;P&gt;&lt;U&gt;1.Nothing&lt;/U&gt; &lt;BR&gt;- Your HTTP spying tool may be misconfigured (try running another, non-Silverlight app, like a regular web browser, to make sure it works) &lt;BR&gt;- Your app may be broken – put a breakpoint where you invoke the service, make sure it’s hit &lt;BR&gt;- You may have a configuration issue – see Configuration section above &lt;BR&gt;- You may be trying to host your application from a &lt;STRONG&gt;file:// &lt;/STRONG&gt;or &lt;STRONG&gt;https:// &lt;/STRONG&gt;URL, or trying to call an &lt;STRONG&gt;https:// &lt;/STRONG&gt;service &lt;/P&gt;
&lt;P&gt;&lt;U&gt;2. Just a service request &lt;BR&gt;&lt;/U&gt;- Congratulations – you’ve avoided a cross-domain situation if you see the actual request to the service on the wire. &lt;BR&gt;- Is the address what you expected it to be? &lt;BR&gt;- Look at what’s coming back. Is it timing out or are you getting a 404? Your service or even WCF itself may not be set up correctly. &lt;BR&gt;- Are you getting a SOAP fault back? If so, read carefully what’s in the fault – it will usually have enough information to debug the issue. &lt;BR&gt;- In general, look very carefully at both the request and the reply (including the body and HTTP headers) &lt;BR&gt;- Did you remove anything to get the proxy to compile? The service may actually require some items that you removed (e.g. may require certain SOAP headers) &lt;/P&gt;
&lt;P&gt;&lt;U&gt;3. A request to &lt;STRONG&gt;&lt;EM&gt;clientaccesspolicy.xml &lt;/EM&gt;&lt;/STRONG&gt;(and possibly &lt;STRONG&gt;&lt;EM&gt;crossdomain.xml &lt;/EM&gt;&lt;/STRONG&gt;afterwards), followed by a request to the service&lt;/U&gt; &lt;BR&gt;- Congratulations – you have a cross-domain situation but you have successfully set up your cross-domain policy files &lt;BR&gt;- This is now equivalent to situation #2 above &lt;/P&gt;
&lt;P&gt;&lt;U&gt;4. Just a request to &lt;STRONG&gt;&lt;EM&gt;clientaccesspolicy.xml &lt;/EM&gt;&lt;/STRONG&gt;and nothing else&lt;/U&gt; &lt;BR&gt;- Most likely a malformed &lt;STRONG&gt;&lt;EM&gt;clientaccesspolicy.xml&lt;/EM&gt;&lt;/STRONG&gt;, or one that contains a policy that forbids cross-domain access &lt;/P&gt;
&lt;P&gt;&lt;U&gt;5. A request to &lt;STRONG&gt;&lt;EM&gt;clientaccesspolicy.xml&lt;/EM&gt;&lt;/STRONG&gt;, then &lt;STRONG&gt;&lt;EM&gt;crossdomain.xml&lt;/EM&gt;&lt;/STRONG&gt;, then nothing else&lt;/U&gt; &lt;BR&gt;- Basically, something went wrong with cross-domain policy files. &lt;BR&gt;- Are you getting 404s back? Check if you’re hosting the files correctly and at the correct locations &lt;BR&gt;- Are you getting the actual files back? They may be malformed or may forbid cross-domain access &lt;/P&gt;
&lt;P&gt;&amp;nbsp;-- Eugene Osovetsky, Program Manager, Silverlight Web Services team&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8399338" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlightws/archive/tags/wcf/default.aspx">wcf</category><category domain="http://blogs.msdn.com/silverlightws/archive/tags/crossdomain/default.aspx">crossdomain</category><category domain="http://blogs.msdn.com/silverlightws/archive/tags/debugging/default.aspx">debugging</category><category domain="http://blogs.msdn.com/silverlightws/archive/tags/soap/default.aspx">soap</category></item><item><title>Getting full exceptions in Silverlight 2 Beta 1</title><link>http://blogs.msdn.com/silverlightws/archive/2008/04/06/getting-full-exceptions-in-silverlight-2-beta-1.aspx</link><pubDate>Mon, 07 Apr 2008 05:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8364285</guid><dc:creator>SLWSTeam</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/silverlightws/comments/8364285.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlightws/commentrss.aspx?PostID=8364285</wfw:commentRss><description>&lt;P&gt;When debugging Silverlight 2 Beta 1 apps in Visual Studio, you might see exceptions show up like this:&lt;/P&gt;&lt;CODE&gt;An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code&lt;BR&gt;&lt;BR&gt;Additional information: [UnexpectedHttpResponseCode]&lt;BR&gt;Arguments:Not Found&lt;BR&gt;Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See &lt;A href="http://go.microsoft.com/fwlink/?linkid=106663&amp;amp;Version=2.0.30226.2&amp;amp;File=System.ServiceModel.dll&amp;amp;Key=UnexpectedHttpResponseCode"&gt;http://go.microsoft.com/fwlink/?linkid=106663&amp;amp;Version=2.0.30226.2&amp;amp;File=System.ServiceModel.dll&amp;amp;Key=UnexpectedHttpResponseCode&lt;/A&gt;&lt;/CODE&gt; 
&lt;P&gt;By default Silverlight does not include the full exception strings. They are stripped out of assemblies in order to realize cost savings in the Silverlight runtime download package. &lt;/P&gt;
&lt;P&gt;This post talks about how to configure your machine to get the full exception strings back in Visual Studio debugging sessions.&lt;/P&gt;
&lt;H4&gt;Runtime (Core) Assemblies&lt;/H4&gt;
&lt;P&gt;The Silverlight runtime assemblies&amp;nbsp;are installed&amp;nbsp;on every user's machine when they download and install the Silverlight runtime. These assemblies live in the C:\Program Files\Microsoft Silverlight\2.0.30226.2 folder on the user's hard drive. To keep the Silverlight runtime download package small, these assembles do not contain any exception strings. When an exception is thrown and not caught, a barebones message is shown to the user, like the one shown above. &lt;/P&gt;
&lt;P&gt;The size savings from removing the full exceptions make sense for the end user, but when developing apps the full exception strings are needed.&amp;nbsp;They are included in the Silverlight SDK&amp;nbsp;install.&amp;nbsp;For each runtime assembly&amp;nbsp;the&amp;nbsp;SDK will install an additional .debug.resources.dll assembly (which contains the full exception string) in a "en-us" folder alongside the original assembly. The shows System.ServiceModel.dll as an example:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG title="Silverlight runtime with debug resources installed" style="WIDTH: 540px; HEIGHT: 732px" height=732 alt="Silverlight runtime with debug resources installed" src="http://blogs.msdn.com/photos/silverlightws/images/8370489/original.aspx" width=540 mce_src="http://blogs.msdn.com/photos/silverlightws/images/8370489/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The only manual step needed to enable full exceptions&amp;nbsp;&lt;/STRONG&gt;is to modify the Silverlight manifest file - C:\Program Files\Microsoft Silverlight\2.0.30226.2\slr.dll.managed_manifest. This is shown in the &lt;A class="" title="Silverlight 2 SDK Beta 1 release notes" href="http://www.microsoft.com/silverlight/resources/readme.aspx?v=2.0&amp;amp;sdk=true" mce_href="http://www.microsoft.com/silverlight/resources/readme.aspx?v=2.0&amp;amp;sdk=true"&gt;Silverlight 2 SDK Beta 1 release notes&lt;/A&gt;, under the "slr.dll.managed_manifest needs to be manually edited ..." topic. For every runtime assembly you need to add something like:&lt;/P&gt;&lt;CODE&gt;&lt;FONT color=#0000ff&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;localizedassembly&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;System.ServiceModel.debug.resources&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;name&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;version&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;2.0.5.0&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;version&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;publickeytoken&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;31bf3856ad364e35&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;publickeytoken&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;relfolder&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;.&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;relfolder&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;file&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;System.ServiceModel.debug.resources.dll&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;file&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;BR&gt;&amp;lt;/&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;&lt;FONT color=#a31515 size=2&gt;localizedassembly&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#0000ff size=2&gt;&amp;gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/CODE&gt;
&lt;P&gt;After this modification, Visual Studio will show the full exception text:&lt;/P&gt;&lt;CODE&gt;An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code&lt;BR&gt;&lt;BR&gt;Additional information: The remote server returned an unexpected response: (404) Not Found.&lt;/CODE&gt; 
&lt;H4&gt;Extension Assemblies&lt;/H4&gt;
&lt;P&gt;These assemblies contain specialized functionality and are not installed with the Silverlight runtime. If a Silverlight app references one of these assemblies, the assembly gets packaged together with the app's own assemblies, inside the .xap package (something Visual Studio does automatically). Developers get these assemblies by installing the Silverlight SDK, which places them in the C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client folder. Again, the Silverlight runtime does not look inside this folder, and the only way the end user can get these assemblies is if they are in the app's .xap file.&lt;/P&gt;
&lt;P&gt;Since the extension assemblies are included with apps on-demand, and are not part of the Silverlight runtime download, the full exception strings &lt;STRONG&gt;are &lt;/STRONG&gt;included in the assemblies themselves. You will automatically get full exceptions, like so:&lt;/P&gt;
&lt;P&gt;&lt;CODE&gt;An exception of type 'System.NotSupportedException' occurred in System.ServiceModel.Syndication but was not handled in user code&lt;BR&gt;&lt;BR&gt;Additional information: Error in line 2 position 2. The Rss20Serializer does not support RSS version '4.0'.&lt;/CODE&gt; &lt;/P&gt;
&lt;P&gt;Hope this is helpful!&lt;/P&gt;
&lt;P&gt;Yavor Georgiev&lt;BR&gt;Program Manager&lt;BR&gt;Connected Framework&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8364285" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlightws/archive/tags/debugging/default.aspx">debugging</category></item></channel></rss>