Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have IIS Hosted WCF application and svc file is:
XML
<%@ ServiceHost Language="C#" Debug="true" Service="Spectrum.SpectrumService.SpectrumService" CodeBehind="SpectrumService.cs" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>

Web.config file in WCF Service Application
XML
<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="AspNetAjaxBehavior" >
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior name="AspNetSOAPBehavior">
        </behavior>
      </endpointBehaviors>
    </behaviors>

    <services>
      <service name="Spectrum.SpectrumService.SpectrumService" behaviorConfiguration="AspNetAjaxBehavior" >
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
        <endpoint address="soapreq" behaviorConfiguration="AspNetSOAPBehavior" bindingConfiguration="basicHttpBinding"
                  binding="basicHttpBinding" contract="Spectrum.SpectrumService.IUserSpectrumService" name="BasicHttpBinding_IUserSpectrumService" />
      </service>
    </services>
  </system.serviceModel>
</configuration>

I call a method from service
C#
UserSpectrumServiceClient client = new UserSpectrumServiceClient();            
            lblName.Text = client.UserRegistration();            
            client.Close();


when method UserRegistration called I get following error

There was no endpoint listening at http://localhost:2639/SpectrumService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

How to resolve this issue? Please help me.
Posted

Add this bit to your web.config file in <system.servicemodel>. Here address is the location of your web service.

HTML
<client>
      <endpoint address="http://localhost:2639/SpectrumService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserSpectrumService"
        contract="Spectrum.SpectrumService.IUserSpectrumService" name="BasicHttpBinding_IUserSpectrumService" />
    </endpoint></client>
 
Share this answer
 
this is my service config i also getting this error
XML
<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="WebBehavior">
          <!--<enableWebScript/>-->
          <webHttp automaticFormatSelectionEnabled="false" helpEnabled="true" defaultOutgoingResponseFormat="Json"/>

        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>

    <services>
      <service name="TestingServices.TestService" behaviorConfiguration="ServiceBehaviour">
        
        <endpoint address="" binding="webHttpBinding" contract="TestingServices.ITestService" name="basichttp_service" bindingConfiguration="crossDomain" behaviorConfiguration="WebBehavior">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <serviceHostingEnvironment  multipleSiteBindingsEnabled="true" />
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint crossDomainScriptAccessEnabled="true"/>
      </webHttpEndpoint>
      <webScriptEndpoint>
        <standardEndpoint crossDomainScriptAccessEnabled="true"/>
      </webScriptEndpoint>
    </standardEndpoints>
    <bindings>
      <webHttpBinding>
        <binding name="default"/>
        <binding name="crossDomain" crossDomainScriptAccessEnabled="true"/>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>



\\\this is my client config \\\\


XML
<system.serviceModel>
   <client>
      <endpoint name="ITestService" address="http://localhost:1579/TestService.svc" binding="wsHttpBinding" contract="TestServiceReference.ITestService"/>
    </client>
</system.serviceModel>
 
Share this answer
 
Comments
Member 10258454 27-Apr-18 1:34am    
i have deployed WCF service on server and on server SSL certificate installed.
now i want to use this service in my WPF application but i am getting same error.
"There was no endpoint listening at https://domainname/UsersData.svc/IsEmailExits that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details."

please help me .. how can i handle this error if you need any other info please let me know.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900