Search code examples
c#asp.netwcfsoapwcf-endpoint

Consuming WCF service


When I use Live WCF service it shows error

There was no endpoint listening at this that could accept the message. This is often caused by an incorrect address or SOAP action


Solution

  • Put your end-point configuration on Web.config on root of your project.

    this is sample of a web.config with end-point.

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="TransportSecurity">
              <security mode="Transport">
                <transport clientCredentialType="None"/>
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <services>
          <service  behaviorConfiguration="TestWcfHttps1.Service1" name="TestWcfHttps1.Service1">
            <endpoint address="https://MYSERVER/GpTest/Service1.svc" 
    
                      binding="basicHttpBinding" 
    
                      bindingConfiguration="TransportSecurity"
    
                      contract="TestWcfHttps1.IService1">
              <identity>
                <dns value="" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="TestWcfHttps1.Service1">
              <serviceMetadata httpsGetEnabled="true" externalMetadataLocation="https://MYSERVER//GpTest/Service1.wsdl" />
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    </configuration>
    

    The above sample code will fix your problem, but please describe more about your projects on your solution and put your code here. Did you consume the web-service in a class library and reference it on your web-app project ?