WCF Web Service Binding Configuration Not Applicable

I have a WCF web service called "Palladium", which is created as a project in VS2008 solution.
I have an ASP.Net web application that hosts this service on a page called "Palladium.svc".
When I submit form data to a web service, my service receives this data and can do something with it.

Now I send images to the service, and the message size exceeds the default property maxReceivedMessageSize . To get around this, I added the endpoint binding configuration in the ASP.NET web.config web application.

My problem is that the binding configuration does not seem to apply.

The service is sent from the iPhone application, and when the message size is less than 65 thousand, the service works fine. As soon as the message size exceeds this, I get a 400 error (invalid request).
For testing purposes, I created the test.aspx file in my ASP.Net web application, which contains some form values ​​and an image for the web service. Again, when the size of the message depends on the default size of 65k, the Service works fine. More than 65 thousand, and I get 400 errors.

The test page displays the URL corresponding to the following URITemplate /job-photo/{photoId}/{palladiumId}/{jobId}

If someone can help me debug this problem, it would be very grateful.

Layout for the test page :

  <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" action="http://localhost/cds/resources/services/palladium.svc/job-photo/1/235DE168-5D1C-46A4-89F2-FD17C6B9F415/567" method="post" enctype="multipart/form-data"> <div> <input type="text" name="user" value="joe bloggs" /> <input type="file" name="photo" /> <input type="submit" name="btnsubmit" value="submit" /> </div> </form> </body> </html> 

Service information from web.config :

  <system.serviceModel> <bindings> <wsHttpBinding> <binding name="large_message_binding" maxBufferPoolSize="5242880" maxReceivedMessageSize="5242880"> <readerQuotas maxStringContentLength="5242880" maxArrayLength="5242880" maxBytesPerRead="5242880" /> </binding> </wsHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="CDS.UI.Resources.Services.PalladiumBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> <services> <service behaviorConfiguration="CDS.UI.Resources.Services.PalladiumBehavior" name="CDS.UI.Resources.Services.Palladium"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="large_message_binding" contract="CDS.PalladiumService.IPalladium"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> </system.serviceModel> 

Markup from Palladium.svc

  <%@ ServiceHost Language="C#" Debug="true" Service="CDS.PalladiumService.Palladium" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %> 
+4
source share
1 answer

I realized that

 Service="CDS.PalladiumService.Palladium" 

must refer to the base type.

Like the name attribute here:

 <service behaviorConfiguration="CDS.UI.Resources.Services.PalladiumBehavior" name="CDS.UI.Resources.Services.Palladium"> 

If you assign them to the actual type of the base class of the service, does it solve your problem?

+4
source

All Articles