1
votes

I found similar posts, but everything I've tried doesn't work. Can you please tell me what am I doing wrong? First is my client config and second my server config. First I thought that it is because I try to receive a large amount of data, but that wasn`t the problem in my case.

<appSettings>
  <add key="webpages:Version" value="3.0.0.0" />
  <add key="webpages:Enabled" value="false" />
  <add key="ClientValidationEnabled" value="true" />
  <add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
  <authentication mode="None" />
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime maxRequestLength="32768" targetFramework="4.5" />
</system.web>
<system.serviceModel>
  <client>
    <endpoint address="http://localhost:56923/TestService.svc?wsdl"
              behaviorConfiguration="webBehavior" 
              binding="webHttpBinding"
              bindingConfiguration="webHttpBinding"
              contract="TestService.TestService"
              name="WcfServiceApp.TestService" />
  </client>
  <bindings>
    <webHttpBinding>
      <binding name="webHttpBinding" 
               maxBufferSize="2097151"
               maxBufferPoolSize="2097151"
               maxReceivedMessageSize="2097151">
        <readerQuotas maxDepth="128" 
                      maxStringContentLength="2147483647"
                      maxArrayLength="16384" 
                      maxBytesPerRead="4096" 
                      maxNameTableCharCount="16384" />
      </binding>
    </webHttpBinding>
  </bindings>
  <behaviors>
    <endpointBehaviors>
      <behavior name="webBehavior">
        <webHttp />
        <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      </behavior>
    </endpointBehaviors>
  </behaviors>
</system.serviceModel>
<system.webServer>
  <modules>
    <remove name="FormsAuthentication" />
  </modules>
</system.webServer>

<system.web>
  <compilation debug="true" targetFramework="4.5" />
  <httpRuntime maxRequestLength="32768" targetFramework="4.5"/>
</system.web>
<system.serviceModel>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="false"/>
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="webBehavior">
        <webHttp />
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <bindings>
    <webHttpBinding>
      <binding name="webHttpBinding" 
               maxBufferSize="2097151" 
               maxBufferPoolSize="2097151" 
               maxReceivedMessageSize="2097151">
        <readerQuotas maxDepth="128" 
                      maxStringContentLength="2097151"
                      maxArrayLength="16384" 
                      maxBytesPerRead="4096" 
                      maxNameTableCharCount="16384" />
      </binding>
    </webHttpBinding>
  </bindings>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
  <modules runAllManagedModulesForAllRequests="true"/>
  <directoryBrowse enabled="true"/>
</system.webServer>
1

1 Answers

0
votes

One thing that jumps out is the <client> configuration in the client's config, specifically the address attribute.

address="http://localhost:56923/TestService.svc?wsdl"

First, you said you're using REST, so the WSDL file doesn't play a role in that (it's for SOAP services).

Second, the WSDL file is not the service, it's the Web Service Description Language file, which describes the web service so clients can build a proxy to it (again, this is for SOAP, not REST).

Try changing the address in your client config to just the service file:

address="http://localhost:56923/TestService.svc"