远程服务器返回错误:NotFound

问题描述:

我有一个Silverlight应用程序,它在我的asp.net应用程序中使用WCF服务。Silverlight应用程序以墨迹笔画的形式保存“绘画”。这些笔画的形式是xaml(可能很大),我将其转换为字符串并发送到服务以将字符串保存到sql server。 (基本上做这个应用程序相同的类型http://msdn.microsoft.com/en-us/magazine/cc721604.aspx)。远程服务器返回错误:NotFound

这个工作,我可以看到我的服务方法正在打的时候,绘图是相对较小,但如果绘图变得很大,我得到这个伟大的错误和服务方法断点永远不会被击中。看起来我已经通过了一个规模门槛,但我无法弄清楚我是对的还是要改变什么才能解决问题。

我已经谷歌和SO没有成功,所以任何帮助将不胜感激。提前致谢。

我的服务:

[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 
} 

我与服务的web.config asp.net应用

<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> 

当VS显示错误

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; 
     } 

异常

{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)} 
+1

哪里是_actual_错误的内容,其所有的宏伟? – 2011-03-03 19:43:01

+0

@Mr。失望 - 对不起,没有发布,因为我读过它的一个非常普遍和无益的错误,但我会编辑我的文章。 – AGoodDisplayName 2011-03-03 19:56:24

尝试增加readerQuotas - 添加binding元素中该元素

<readerQuotas maxStringContentLength="2147483647" /> 

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

+0

或者,它可能是maxArrayLength。图像可能被序列化为数组。 – RQDQ 2011-03-03 19:49:08

+1

我们有一个赢家!非常感谢。 – AGoodDisplayName 2011-03-03 20:05:22

你尝试过打开WCF Tracing?我不确定这是否适用于Silverlight(鉴于Silverlight在本地硬盘方面存在很多安全限制),因此您可能需要设置一个简单的no silverlight客户端,并在打开诊断程序的情况下重新创建呼叫。

编辑:或者,可能是readerQuotas的的MaxArrayLength成员...