1

So everytime I run my web site application in visual studio I get this error :

Could not find default endpoint element that references contract 'ServiceReference1.IService1' 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.

I took a look at previous posts for this solution but I still cannot solve the issue. Any insight?

the web.config file for my service:

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.6.1"/>
  </system.web>
  <system.serviceModel>
    <bindings />
    <client />
    <behaviors>
      <serviceBehaviors>
        <behavior name="servicebehavior">
          <!-- 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="web">
          <webHttp/>
        </behavior>
      </endpointBehaviors>

    </behaviors>
    <services>
      <service behaviorConfiguration="servicebehavior" name="WcfService2.Service1">
        <endpoint address="" contract="WcfService2.IService1" binding="webHttpBinding" behaviorConfiguration="web">      
        </endpoint>
      </service>
    </services>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />

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

</configuration>

Here is my website Default.aspx proxy object:

ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client();
  • 1
    The contract specified in your endpoint is `WcfService2.IService1`, not `ServiceReference1.IService1`. It looks as if you might have added a service reference but then removed the endpoint that was created in your .config. So you've got an autogenerated proxy class looking for `ServiceReference1.Service1` but that endpoint doesn't exist. – Scott Hannen Mar 07 '18 at 13:50
  • @hitesh yeah thats the one I looked out before posting my question. – bbymintdrop Mar 07 '18 at 15:39

0 Answers0