I have a Silverlight app that consumes a WCF service in my asp.net application.The silverlight app saves "drawings" in the form of ink strokes. These strokes are in the form of xaml (which can be kind of large) of which I am converting to a string and sending to the service to save the string to sql server. (Basically does the same type of thing as this app http://msdn.microsoft.com/en-us/magazine/cc721604.aspx).
This works and I can see my service method is being hit when the drawing is relatively small, but if the drawing gets to big I get this great error and the services method break point never gets hit. It seems that I am passing a size threshold, but I can't figure out if I'm right or what to change to resolve the issue.
I have seached google and SO with no 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 service web.config
<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 is showing 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;
}
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)}
Try increasing the readerQuotas -- add this element inside the binding
element
<readerQuotas maxStringContentLength="2147483647" />
http://msdn.microsoft.com/en-us/library/ms731325.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With