The remote server responded with an error: NotFound

I have a Silverlight application that uses the WCF service in my asp.net application. Silverlight saves ink drawings as drawings. These strokes are represented as xaml (which can be large), from which I convert the string to string and send the service to save the string to sql server. (Basically does the same thing as this application http://msdn.microsoft.com/en-us/magazine/cc721604.aspx ).

This works, and I see that my service method hits when the drawing is relatively small, but if the drawing gets large, I get this big error and the service method breakpoint never hits. It seems that I am missing the size threshold, but I cannot figure out if I am right or what to change to solve the problem.

I have google and SO without success, so any help would be appreciated. Thanks in advance.

My service:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class DrawingService: IDrawingService { #region IDrawingService Members public bool SaveEvalAreaDrawing(int EvalAreaId, string xmlToSave) { return true; } public bool SaveEvalItemDrawing(int EvalItemId, string xmlToSave) { return true; } public string GetEvalAreaDrawing(int EvalAreaId, string xmlToSave) { return "you got the eval drawing!"; } public string GetEvalItemDrawing(int EvalItemId, string xmlToSave) { return "you got the eval item drawing!"; } #endregion } 

My asp.net app with web.config service

 <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="MyNameSpace.Services.DrawingServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <bindings> <customBinding> <binding name="customBinding0"> <binaryMessageEncoding /> <httpTransport> <extendedProtectionPolicy policyEnforcement="Never" /> </httpTransport> </binding> </customBinding> <wsHttpBinding> <binding name="wsPlainBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="None"> <transport clientCredentialType="None"> <extendedProtectionPolicy policyEnforcement="Never" /> </transport> <message clientCredentialType="None" negotiateServiceCredential="false" establishSecurityContext="false" /> </security> </binding> </wsHttpBinding> </bindings> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> <services> <service behaviorConfiguration="HSD.ECERS.Services.DrawingServiceBehavior" name="HSD.ECERS.Services.DrawingService"> <endpoint address="Services" binding="wsHttpBinding" bindingConfiguration="wsPlainBinding" name="wsPlainHttp" contract="HSD.ECERS.Services.IDrawingService" /> <endpoint address="mex" binding="mexHttpBinding" name="wsdl" contract="IMetadataExchange" /> </service> </services> 

ServiceReferences.ClientConfig

 <configuration> <system.serviceModel> <bindings> <customBinding> <binding name="wsPlainHttp"> <textMessageEncoding messageVersion="Default" writeEncoding="utf-8" /> <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"> <extendedProtectionPolicy policyEnforcement="Never" /> </httpTransport> </binding> </customBinding> </bindings> <client> <endpoint address="http://localhost:41594/Services/DrawingService.svc/Services" binding="customBinding" bindingConfiguration="wsPlainHttp" contract="EvalDrawingService.IDrawingService" name="wsPlainHttp" /> </client> </system.serviceModel> </configuration> 

Where VS shows the error

 public bool EndSaveEvalAreaDrawing(System.IAsyncResult result) { object[] _args = new object[0]; bool _result = ((bool)(base.EndInvoke("SaveEvalAreaDrawing", _args, result))); // Here is where is popping up return _result; } 

An exception

 {System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState) --- End of inner exception stack trace --- at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) --- End of inner exception stack trace --- at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result) at EvaluaionAncillaryControl.EvalDrawingService.DrawingServiceClient.DrawingServiceClientChannel.EndSaveEvalAreaDrawing(IAsyncResult result) at EvaluaionAncillaryControl.EvalDrawingService.DrawingServiceClient.EvaluaionAncillaryControl.EvalDrawingService.IDrawingService.EndSaveEvalAreaDrawing(IAsyncResult result) at EvaluaionAncillaryControl.EvalDrawingService.DrawingServiceClient.OnEndSaveEvalAreaDrawing(IAsyncResult result) at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)} 
+7
source share
2 answers

Try to increase readerQuotas - add this element inside the binding element

 <readerQuotas maxStringContentLength="2147483647" /> 

http://msdn.microsoft.com/en-us/library/ms731325.aspx

+7
source

Did you try to enable WCF tracing ? I'm not sure if this works with Silverlight (given that Silverlight has many security restrictions in terms of the local hard drive), so you may need to set up a simple silverlight client and play a call with diagnostics enabled.

EDIT: Or maybe be a member of maxArrayLength to read Quotas ...

0
source

All Articles