locked
Entity Data Service and SQL Server 2008 Filestream issue (The remote server returned an error: (400) Bad Request) RRS feed

  • Question

  •  

    Hi,

     

    I have a SQL 2008 Table which support FileStream.

    My client application contains some fields which are bound to the source

     

    When I try to save my Data with the file content which is a ZIP file, I got an error:

    [9420] The remote server returned an error: (400) Bad Request.

    My past expercience with bad request and WCF services was related to web.config with didn't contain

    the right value for properties like maxBufferSize, maxBufferPoolSize, maxReceivedMessageSize etc...

     

    The issue in my case is this is an Ado Data Service and the proxy has been generated by DataSvcUtil.exe and not settings are configured in the client app.config.

     

    Is anybody knows how to solve it ?

     

    Thanks

    -Vince

    Friday, August 8, 2008 8:54 PM

All replies

  • Hi ,

     An ado.net data service is a WCF service at the base.

     You can configure these limits the same way on the server as you would with a normal WCF Service. No configuration changes are required on the client side.

     

    To increase the limit of data that can be POSTed to a Data Servuce , change the WCF configuration to include custom bindings which specify the MaxReceivedMessageSize Property :

     

    Code Snippet

    <system.serviceModel>
        <services>
          <service name="<ServiceName>">
            <endpoint 
    binding="webHttpBinding"
    bindingConfiguration="higherMessageSize"
    contract ="System.Data.Services.IRequestHandler"></endpoint>
          </service>
        </services>
        <bindings>

          <webHttpBinding>
            <binding name="higherMessageSize" maxReceivedMessageSize ="122880"/>
          </webHttpBinding>
        </bindings>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
      </system.serviceModel>

     

     

    Monday, August 11, 2008 6:06 PM
    Moderator
  • Thanks. I'll try this settings.

     

    Anyway, in some of my past WCF projects, to make to work, I had to get same settings in client app.config.

    and when we generate a wcf proxy with 'Add Service Reference' or svcutil.exe, the app.config is modified to add the right binding.

     

    For data service, is this the case here too ? Must I add manually the binding in my client app.config ?

     

    Thanks

    -Vince

     

    Tuesday, August 12, 2008 6:49 AM
  • Hi Vince,

     

     The Client doesnt really use WCF Bindings to interact with the Server.

     It uses HttpWebRequest  to talk to the server , you can configure limits on the HttpWebRequest by customizing the System.net configuration section .

     

     For more details : HttpWebRequestElement

    Tuesday, August 12, 2008 3:42 PM
    Moderator
  • I too am running into this issue.  I modified my web.config with the recommended changes and they are not correcting the issue.  My data service is running under IIS 7.0 (Vista).

     

    <system.serviceModel>

      <services>

        <service name="AssureTec.EnterpriseLibrary.Server.NorthwindService">

          <endpoint binding="webHttpBinding" bindingConfiguration="webHttpLargeMessage" contract="System.Data.Services.IRequestHandler" />

        </service>

      </services>

      <bindings>

        <webHttpBinding>

          <binding name="webHttpLargeMessage" maxReceivedMessageSize="1048576" />

        </webHttpBinding>

      </bindings>

      <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

    </system.serviceModel>

     

    Exception:

     

    A first chance exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll

     

    Additional information: The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.

    Is there something I am missing?

    Tuesday, September 30, 2008 9:13 PM