简体   繁体   中英

Namespaces for WCF Web.config, client and server side, maxReceivedMessageSize

I'm not a VB developer and I'm having some issues with Namespace for a Web service. I own both the client and server side of this so I have no issues changing settings.

I'm trying to connect to a webservice and while doing so I get a MaxReceivedMessageSize exception.

They way I go about this is that I have a solution with a "web project" and more "class projects", in one of my "class projects" I have a Service reference and a app.config file where I do my settings.

I have read that I need to have app.config settings in my application and add settings on server web.config for the web service. I'm confused about the namespaces I need to set in the web.config for the web.service on server side. Can anybody help me out a bit? I use this settings

(server)

<system.serviceModel>
        <bindings>
            <wsHttpBinding>
                <binding name="Erp_QueryServiceSoap" maxReceivedMessageSize="2147483647">
                  <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                </binding>
          </wsHttpBinding>
        </bindings>
        <services>
            <service name="WebService.Erp_QueryService.Erp_QueryServiceSoap">
              <endpoint address="Erp_QueryService.Erp_QueryServiceSoap"
                  binding="wsHttpBinding" bindingConfiguration="Erp_QueryServiceSoap"
                  contract="Erp_QueryService.Erp_QueryServiceSoap" name="Erp_QueryServiceSoap" />
            </service>
        </services>
    </system.serviceModel>

(client)

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="Erp_QueryServiceSoap" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="CONNECTION TO SERVICE"
          binding="wsHttpBinding" bindingConfiguration="Erp_QueryServiceSoap"
          contract="ServiceQuery.Erp_QueryServiceSoap" name="Erp_QueryServiceSoap" />
    </client>
  </system.serviceModel>

i think may be problem is not with namespaces. try to set maxItemsInObjectGraph to the following.

in behaviour section

<behavior name="YourServiceNameBehaviour">
  <serviceMetadata httpGetEnabled="true" />
  <serviceDebug includeExceptionDetailInFaults="true" />
  **<dataContractSerializer maxItemsInObjectGraph="2147483647" />**
</behavior>

i think you already have added those codes except

 **<dataContractSerializer maxItemsInObjectGraph="2147483647" />**

try adding this code line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM