views:

1050

answers:

2

Hi folks,

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.

But one after the other.

I have a 64bit W2008 Server machine with VS 2008 SP1 german version, Silverlight Tools 3.0

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.

I created a new WCF-Service, named an Endpoint and set its binding to basicHttpBinding. I added the attribute

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

to the Service1 class and the line

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

to the system.serviceModel in the App.config

I left everything else as it is and tested the service via WCF-client successfully. Then I published it to my local IIS7 to http://localhost/WCFTest

Within my Silverlight application, I added the service to the Servicereference using http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc

I added the following code to the client:

using OSMDeepEarthExample.ServiceReference1;

...
Service1Client s1 = new Service1Client();
s1.GetDataCompleted += new System.EventHandler<GetDataCompletedEventArgs>(s1_GetDataCompleted);
s1.GetDataAsync(20);

void s1_GetDataCompleted(object sender, GetDataCompletedEventArgs e)
{
  CountFetchedData.Text = e.Result;
}

I added a clientaccesspolicy.xml AND a crossdomain.xml to the webroot (C:\inetpub\wwwroot)

clientaccesspolicy.xml:

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from>
        <domain uri="*"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

crossdomain.xml:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
<cross-domain-policy>
  <allow-access-from domain="*" />
  <allow-http-request-headers-from domain="*" headers="SOAPAction" />
</cross-domain-policy>

I restarted the IIS. Twice. Often.

I installed Web Development Helper to maybe get more meaningful information about WHAT is wrong. But this makes the IE crash.

I am out of ideas. And soon start to be aggressive against my hardware. Please help my hardware!

As John noted, I did forgot the full Errormessage here it comes:

Fehler beim Senden einer Anforderung an den URI "http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc". 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.

In short, it says there may be an interdomain rule be missing.

+2  A: 

Whew, I've done it!

I removed the clientaccesspolicy.xml from the webroot, leaving only crossdomain.xml there. What an odyssee! Thank you for listening, it helped to clear my mind. I hope someone with a similar problem will find the text helpfull a little bit!

Aaginor
this also works with vs2010, sl4, w7. after hours I found your solution. dankeschöööööön
devio
A: 

THANK YOU!

THAT HELPED ME SOOO MUCH! THANK YOU THANK YOU THANK YOU.

Just deleted the clientaccesspolicy.xml and it worked with the above crossdomain.xml in the webservice directory. thank you!

Dai