0

My WCF service web.config.

<?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>

My wcf client 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>

My Error when I run my Windows Phone Application.

There was no endpoint listening at http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Explanation

I searched but I don't get it fixed. There is something wrong with my endpoints but I don't know what.

  • Can you get to your service from web browser? I mean, can you browse to http://zesdaagse.mobi-app.be/WCFUrl/MobileService.svc ? – evgenyl Apr 18 '13 at 06:58
  • Hello Sigrid. (nice: 6daagse :)) Did you check the inner exception and the event logs of the web service? In which host is this running? (IIS?) You can return the exception details through this behavior: – Sam Vanhoutte Apr 18 '13 at 08:27

1 Answers1

0

Ah, now I see it You are using the basicHttpBinding in your client and the webHttpBinding (REST) in your service... That's probably the reason why it's not working, no?

Extra FYI: I tried to call your service myself and now I get a 405, which probably means you didn't specify the [WebGet] or [WebInvoke] attributes to your service operations.

With the following client side config, you should be able to call your service (after attributing your operations with 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>
Sam Vanhoutte
  • 3,247
  • 27
  • 48
  • Same trouble. But now i get the KeyNoTFoundException was unhandled, didn't found anything to help me with that..Normally everything is configured completely but know this exception. Any idea how to fix? (This is running by IIS) And what do you mean with behavior: where do i place that? – Sigfrid Maenhout Apr 18 '13 at 08:46
  • it's my first windows phone application. Windows phone generate only a .clientconfig file. And tags like Behaviors doesn't exist in that file. There's also no web.config or app.config in windows phone application project. And Webget en webInvoke I have them. Everythings works of my wcf, data etc I recieve. It's only the problem to set up my clientconfig with the right tags, etc. @Sam Vanhoutte – Sigfrid Maenhout Apr 18 '13 at 09:03
  • sorry, totally not a WP7 expert :( (don't even have the SDK here) - but I still got the 405 with my WCF app :) – Sam Vanhoutte Apr 18 '13 at 09:10
  • Me Neither and it's fustrating. The 405 is because the IIS protects for strangers. Now I get the next exception, i'm getting closer. Endpoint not found. – Sigfrid Maenhout Apr 18 '13 at 09:29
  • Considering you helping hand, i figured it out. Didn't had a reference in my webservice like I did in my clientconfig. That's fixed. Thanks Belgium Friend. :D – Sigfrid Maenhout Apr 18 '13 at 13:47