這會偷走我的理智。我已經瀏覽了我在網上找到的幾乎所有內容,並且沒有向前邁進一步。無論我在做什麼,挫折都不足以形容這個錯誤信息。CommunicationException從Silverlight中調用WCF時出現
但一個接一個。
我有VS 2008 SP1德語版64位W2008 Server機器,工具的Silverlight 3.0
我想從Silverlight應用程序消耗WCF的服務。而且,儘可能多的人,在調用結束時,我得到了非常令人沮喪的非描述性通信異常。
我創建了一個新的WCF服務,命名爲Endpoint並將其綁定爲basicHttpBinding。我添加的屬性
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
到Service類,並在App.config
我離開一切,因爲它是行
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
到system.serviceModel和測試服務通過WCF客戶端成功。然後我把它發佈到我的本地IIS7到http://localhost/WCFTest
在我的Silverlight應用程序,我使用http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc
添加服務到服務引用我下面的代碼添加到客戶端:
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;
}
我加一個clientaccesspolicy.xml和A的crossdomain.xml到根目錄(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">
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="SOAPAction" />
</cross-domain-policy>
我重新啓動IIS。兩次。經常。
我安裝了網站開發助手,可能會得到關於什麼是錯誤的更有意義的信息。但是這會讓IE崩潰。
我沒有想法。並且很快就開始對我的硬件進行攻擊。請幫助我的硬件!
正如約翰指出,我也忘了全ERRORMESSAGE這裏說到:
Fehler BEIM薩登einer Anforderung的巢穴URI 「http://europa.therestofmydomain/WCFTest/WcfTest.Service1.svc」。 Ursache istmöglicherweise,dass ohne die entsprechendedomänenübergreifendeRichtlinie oder mit einer nichtfürSOAP-Dienste geeigneten Richtliniedomänenübergreifendauf einen Dienst zugegriffen wurde。 MöglicherweisemüssenSie sich an den Besitzer des Diensts wenden,damit einedomänenübergreifendeRichtliniendateiveröffentlichtund 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詳細信息芬蘭Siena in der inneren Ausnahme。
總之,它表示可能缺少一個域間規則。
在所有這些挫折之中,你沒有發佈過你收到的異常。完全的例外。 ex.ToString()的結果。 – 2009-08-21 14:15:20
你是對的,我在我的帖子 – Aaginor 2009-08-21 14:42:23