0

I created a WCF service application using SharePoint and in the same solution I have created a SharePoint project to call WCF service. When I deploy the solution it gives a warning.

The 'contract' attribute is invalid - The value 'Myservice.IService1' is invalid according to its datatype 'clientContractType' - The Enumeration constraint failed.

But successfully deployed. But nothing happening in my site. So I started to debug and I got exception in below code.

ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();

Exception says:

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.

Find the web.config file.

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
          textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
            enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
              algorithmSuite="Default" establishSecurityContext="true" />
          </security>
        </binding>
        <binding name="WSHttpBinding_IService11" />
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
        contract="Myservice.IService1" name="WSHttpBinding_IService1">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/"
        binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService11"
        contract="ServiceReference1.IService1" name="WSHttpBinding_IService11">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

I didn't change anything in physical web.config file. Rather than that I have added SharePoint map folder to my solution and added .svc file and web.config file to there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.