2012-02-14 93 views
0

我正在開發WCF服務和Windows Phone客戶端應用程序中的解決方案。問題是,當我在Internet Explorer中輸入服務地址時,即使在模擬器中,我也無法連接到服務。我得到正確的結果。 我的配置文件:WCF服務WindowsPhone - EndpointNotFoundException

<configuration> 
    <system.serviceModel> 
     <bindings> 
      <basicHttpBinding> 
       <binding name="BasicHttpBinding_IMyCustomService" 
         maxReceivedMessageSize="2147483647" 
         maxBufferSize="2147483647" 
         enableHttpCookieContainer="true" 
          /> 
      </basicHttpBinding> 
     </bindings> 
     <client> 
      <endpoint address="http://localhost:2395/MyCustomService.svc" 
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyCustomService" 
       contract="MyService.IMyCustomService" name="BasicHttpBinding_IMyCustomService" /> 
     </client> 
    </system.serviceModel> 
</configuration> 

我的服務接口:

[ServiceContract] 
[ServiceKnownType(typeof(CustomResponse))] 
public interface IMyCustomService 
{ 
     [OperationContract] 
     CustomResponse GetData(); 
} 

我的問題是,每次我試圖在客戶端代理GetDataAsync()方法調用,完成事件不火了,我得到「EndpointNotFoundException」。我嘗試了所有我找到的解決方案,而他們都沒有幫助我。我也嘗試使WPF測試客戶端和它正常工作,但Windows Phone應用程序沒有。

回答

2

我認爲這是您的客戶端配置,例如電話。您指向本地主機,但由於您在本地主機的模擬器中解析爲相同,而不是您的PC託管服務。

address="http://localhost:2395/MyCustomService.svc" 

把你PC's主機名在那裏,你應該罰款

+0

Unfortunatley不起作用。我甚至把它放在了互聯網上。引發EndpointNotFound異常。 (它出現在仿真器和設備上) – TrN 2012-02-15 08:53:20

0

嗯,我不知道它是如何開始的工作,但它沒有。我將我的服務上傳到互聯網託管,並從我的電話客戶端項目中刪除所有服務參考,並將它們與互聯網地址重新添加,現在就可以工作Thx爲您提供幫助Dominik。