WCF Error

WCF Error

Old forum URL: forums.lhotka.net/forums/t/4833.aspx


Ash002 posted on Sunday, May 11, 2008

Hi

We are trying a bit of Silverlight to CSLA via WCF - pre CSLA Lite. As a test we are just assigning from CSLA objects to data objects and transfering the data objects down WCF to Silverlight and back again.

Getting the data there required increasing the MaxReceivedMessageSize. However getting data back is now the problem. When calling a routine via WCF a parameter size of 8192 goes through, but a parameter of 8193 gets the following error:

An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code

Additional information: [UnexpectedHttpResponseCode]
Arguments:Not Found
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.ServiceModel.dll&Key=UnexpectedHttpResponseCode
Have tried setting MaxBufferSize also, but no effect, and setting
<httpRuntime maxRequestLength="32678"/>
in Weg.Config

Any ideas?

Code:

            StringBuilder sb = new StringBuilder() ;
            for (int i = 0; i < 8193 ; i ++)
                sb.Append('0') ;
               
            dataXml = sb.ToString() ;   
           
            System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding() ;
            binding.MaxReceivedMessageSize = int.MaxValue  ;
            binding.MaxBufferSize = int.MaxValue ;
            System.ServiceModel.EndpointAddress remoteAddress = new System.ServiceModel.EndpointAddress("http://localhost:4425/Projection.Central.SilverlightApp_Web/AppDataService.svc") ;
            AppDataService.AppDataServiceClient client = new AppDataService.AppDataServiceClient(
                                                                binding,
                                                                remoteAddress) ;
           
            client.UserDataExchangeCompleted +=
                new EventHandler<AppDataService.UserDataExchangeCompletedEventArgs>(client_UserDataExchangeCompleted);
            client.UserDataExchangeAsync("", dataXml.ToString());

Thanks

RockfordLhotka replied on Monday, May 12, 2008

Just guessing here, but I think you need to set the max sizes on both client and server.

Copyright (c) Marimer LLC