0

I consumed wcf by adding service reference to my project then I changed the web.confing to be like that

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.;initial catalog=Services;user id=sa;password=123;Connect Timeout=45;"/>
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
    </authentication>
    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
    </membership>
    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>
    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
      </providers>
    </roleManager>
  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

  <system.serviceModel>
    <services>
      <service name="DreamServices.DreamService">
        <endpoint address="" binding="webHttpBinding" contract="DreamServices.IServices" behaviorConfiguration="web">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="web">
          <webHttp />
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="defaultRest">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="64" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
      </webHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>


  <appSettings>
    <add key="JsonWebService" value="http://localhost:1381/PMAHost/Service.svc" />
  </appSettings>


</configuration>

but I always get the exception

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

the module system.serviceModel is repeated either in the library or the site

any idea how to fix that

AMH
  • 6,363
  • 27
  • 84
  • 135

1 Answers1

1

This is a service-side configuration

<service name="DreamServices.DreamService">

What does the client-side configuration look like? It should have a client element with contract="DreamServices.IServices" or whatever the name of your contract is.

Kirk Broadhurst
  • 27,836
  • 16
  • 104
  • 169
  • what do u mean by client side configguration – AMH Jul 13 '12 at 07:36
  • In WCF there is a configuration for the 'client' (the process which sends a request) and the 'service' (the process which receives the request). You've posted the config for the 'service'. Check the config for the 'client'. – Kirk Broadhurst Jul 13 '12 at 08:17