2013-04-18 29 views
0

我的WCF服務web.config。我的wcf端點有問題

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <connectionStrings> 
    <add name="ZesdaagseResultsContext" connectionString="Data Source=194.33.112.88\partywhere;Initial Catalog=ZesdaagseResults;Persist Security Info=True;User ID=*********;Password=******************/;MultipleActiveResultSets=True" 
     providerName="System.Data.SqlClient" /> 
    </connectionStrings> 
    <system.serviceModel> 
    <services> 
     <service name="WcfOpzet.MobileService" behaviorConfiguration="MexBehavior"> 
     <endpoint binding="webHttpBinding" contract="WcfOpzet.IMobileService" behaviorConfiguration="webHttpBehavior" /> 
     <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" /> 
     </service> 
    </services> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="MexBehavior"> 
      <serviceMetadata httpGetEnabled="true" /> 
     </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
     <behavior name="webHttpBehavior"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    </system.serviceModel> 
    <startup> 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /> 
    </startup> 
    <system.web> 
    <compilation debug="true" /> 
    </system.web> 
</configuration> 

我的WCF客戶端MobileServiceReference.ClientConfig。

<configuration> 
    <system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
     <binding name="webHttpBinding" 
       maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
      <security mode="None" /> 
     </binding>  
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc" 
       binding="basicHttpBinding" 
       bindingConfiguration="webHttpBinding" 
       contract="MobileService.IMobileService" 
       name="webHttpBinding" 

       /> 
    </client> 
    <!--<behaviors> 
     <endpointBehaviors> 
     <behavior name="webHttpBehavior"> 
      <webHttp/> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors>--> 
    </system.serviceModel> 
</configuration> 

我的錯誤,當我運行我的Windows Phone應用程序。

http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc沒有端點收聽可以接受該消息。這通常是由不正確的地址或SOAP操作引起的。有關更多詳細信息,請參閱InnerException(如果存在)。

說明

我搜索,但我不把它修好。我的端點有問題,但我不知道是什麼。

+0

是否可以從Web瀏覽器找到您的服務?我的意思是,你可以瀏覽到http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc嗎? – evgenyl 2013-04-18 06:58:57

+0

@evgenyl是的,我可以。 – 2013-04-18 07:08:17

+0

你好西格麗德。 (nice:6daagse :)) 您是否檢查了Web服務的內部異常和事件日誌?在哪個主機上運行? (IIS?) 您可以通過此行爲返回異常詳細信息: 2013-04-18 08:27:03

回答

0

啊,現在我看到它 您在客戶端使用basicHttpBinding,在服務中使用webHttpBinding(REST)......這可能是它不工作的原因,不是嗎?

額外費用:我試圖自己調用你的服務,現在我得到了405,這可能意味着你沒有爲你的服務操作指定[WebGet]或[WebInvoke]屬性。

用下面的客戶端配置,你應該能夠調用服務(與WebGet歸結您的操作之後)

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup> 
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
    </startup> 
    <system.serviceModel> 
    <bindings> 
     <webHttpBinding> 
     <binding name="webHttpBinding" 
       maxBufferSize="2147483647" 
       maxReceivedMessageSize="2147483647"> 
      <security mode="None" /> 
     </binding> 
     </webHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc" 
       binding="webHttpBinding" 
       bindingConfiguration="webHttpBinding" 
       contract="MobileService.IMobileService" 
       name="webHttpBinding" 
       behaviorConfiguration="webHttpBehavior" 
       /> 
    </client> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="webHttpBehavior"> 
      <webHttp/> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    </system.serviceModel> 
</configuration> 
+0

同樣的麻煩。但現在我得到了KeyNoTFoundException未處理,沒有發現任何東西來幫助我..通常情況下,一切都完全配置,但知道這個例外。任何想法如何解決? (這是由IIS運行)你是什麼意思的行爲:我在哪裏放置? – 2013-04-18 08:46:34

+0

看到我編輯的答案 – 2013-04-18 08:53:43

+0

這是我的第一個Windows Phone應用程序。 Windows手機只生成一個.clientconfig文件。像Behaviors這樣的標籤在該文件中不存在。在windows phone應用程序項目中也沒有web.config或app.config。和Webget en webInvoke我有他們。我收到的wcf,數據等的各種作品。這只是問題來設置我的clientconfig與正確的標籤等。@Sam Vanhoutte – 2013-04-18 09:03:59