Ne pouvait pas trouver de point de terminaison par défaut de l'élément que les références du contrat d'Hébergement wcf

J'ai un service wcf sur ce site http://wswob.somee.com/wobservice.svc

J'ai essayer de consommer ce service avec mon application winform. C'est l'erreur que je reçois lorsque je créer un instantané du service

com.somee.wobservice.IwobserviceClient myservice = new com.somee.wobservice.IwobserviceClient();

erreur:

Could not find default endpoint element that references contract
'com.somee.wobservice.Iwobservice' in the ServiceModel client configuration section. This 
might be because no configuration file was found for your application, or because no 
endpoint element matching this contract could be found in the client element.

J'ai cherché et modifié mon application.fichier de configuration:

<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="wobservice">
      <clientVia />
    </behavior>
  </endpointBehaviors>
</behaviors>

<client>
  <endpoint
      name="wobservice"
      address="http://wswob.somee.com/wobservice.svc"
      binding="webHttpBinding"
      contract="com.somee.wobservice"
      behaviorConfiguration="wobservice" />
</client>

</system.serviceModel>
</configuration>

Et de mon site web.config dans wcf dossier:

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true"/>

          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>

        <endpointBehaviors>
            <behavior name="Web">
                <webHttp/>
            </behavior>
        </endpointBehaviors>
    </behaviors>

      <serviceHostingEnvironment  multipleSiteBindingsEnabled="true">
          <baseAddressPrefixFilters>
              <add prefix="http://wswob.somee.com/"/>
          </baseAddressPrefixFilters>
      </serviceHostingEnvironment>

      <bindings>
          <webHttpBinding>
              <binding>
                  <security mode="None" />
              </binding>
          </webHttpBinding>
      </bindings>

      <protocolMapping>
           <add binding="basicHttpsBinding" scheme="https"/>
           <add binding="basicHttpBinding" scheme="http"/>
      </protocolMapping>

      <services>
           <service name="wobwcf.wobservice">
              <endpoint address="" 
                        binding="webHttpBinding" 
                        behaviorConfiguration="Web" 
                        contract="wobwcf.Iwobservice" />
           </service>
      </services>
   </system.serviceModel>

Je ne suis pas vraiment sûr de la partie j'ai eu tort. Mon expérience de la wcf est tout juste une semaine...

OriginalL'auteur Jackie Ngo Anh Khoi | 2014-06-05