title: CommunicationException when calling a WCF from Silverlight
body: <p>this is going to steal my sanity. I've been gone through almost everything I found on the web and went no single step forward. Frustration is not strong enough to describe this errormessage come popping up regardless of what I am doing.</p>
  
  <p>But one after the other. </p>
  
  <p>I have a 64bit W2008 Server machine with VS 2008 SP1 german version, Silverlight Tools 3.0</p>
  
  <p>I want to consume a WCF-Service from a Silverlight application. And, as many people, I get this very frustrating non-descript Communication Exception at the end of the invoke.</p>
  
  <p>I created a new WCF-Service, named an Endpoint and set its binding to basicHttpBinding. I added the attribute </p>
  
  <pre><code>[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  </code></pre>
  
  <p>to the Service1 class and the line</p>
  
  <pre><code>&lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"/&gt;
  </code></pre>
  
  <p>to the system.serviceModel in the App.config</p>
  
  <p>I left everything else as it is and tested the service via WCF-client successfully. Then I published it to my local IIS7 to <a href="http://localhost/WCFTest" rel="noreferrer">http://localhost/WCFTest</a></p>
  
  <p>Within my Silverlight application, I added the service to the Servicereference using <a href="http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc" rel="noreferrer">http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc</a></p>
  
  <p>I added the following code to the client:</p>
  
  <pre><code>using OSMDeepEarthExample.ServiceReference1;
  
  ...
  Service1Client s1 = new Service1Client();
  s1.GetDataCompleted += new System.EventHandler&lt;GetDataCompletedEventArgs&gt;(s1_GetDataCompleted);
  s1.GetDataAsync(20);
  
  void s1_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
  {
    CountFetchedData.Text = e.Result;
  }
  </code></pre>
  
  <p>I added a clientaccesspolicy.xml AND a crossdomain.xml to the webroot (C:\inetpub\wwwroot)</p>
  
  <p>clientaccesspolicy.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;access-policy&gt;
    &lt;cross-domain-access&gt;
      &lt;policy&gt;
        &lt;allow-from&gt;
          &lt;domain uri="*"/&gt;
        &lt;/allow-from&gt;
        &lt;grant-to&gt;
          &lt;resource path="/" include-subpaths="true"/&gt;
        &lt;/grant-to&gt;
      &lt;/policy&gt;
    &lt;/cross-domain-access&gt;
  &lt;/access-policy&gt;
  </code></pre>
  
  <p>crossdomain.xml:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
  &lt;cross-domain-policy&gt;
    &lt;allow-access-from domain="*" /&gt;
    &lt;allow-http-request-headers-from domain="*" headers="SOAPAction" /&gt;
  &lt;/cross-domain-policy&gt;
  </code></pre>
  
  <p>I restarted the IIS. Twice. Often.</p>
  
  <p>I installed Web Development Helper to maybe get more meaningful information about WHAT is wrong. But this makes the IE crash.</p>
  
  <p>I am out of ideas. And soon start to be aggressive against my hardware. Please help my hardware!</p>
  
  <p>As John noted, I did forgot the full Errormessage here it comes:</p>
  
  <blockquote>
    <p>Fehler beim Senden einer Anforderung an den URI "<a href="http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc" rel="noreferrer">http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc</a>". Ursache ist möglicherweise, dass ohne die entsprechende domänenübergreifende Richtlinie oder mit einer nicht für SOAP-Dienste geeigneten Richtlinie domänenübergreifend auf einen Dienst zugegriffen wurde. Möglicherweise müssen Sie sich an den Besitzer des Diensts wenden, damit eine domänenübergreifende Richtliniendatei veröffentlicht und das Senden von sich auf SOAP beziehenden HTTP-Headern zugelassen wird. Dieser Fehler kann auch durch Verwendung von internen Typen im Webdienstproxy ohne das InternalsVisibleToAttribute-Attribut verursacht werden. Weitere Details finden Sie in der inneren Ausnahme.</p>
  </blockquote>
  
  <p>In short, it says there may be an interdomain rule be missing.</p>