【问题标题】:WCF after executing service method. System.ServiceModel.CommunicationException: The remote server returned an error: NotFound执行服务方法后的 WCF。 System.ServiceModel.CommunicationException:远程服务器返回错误:NotFound
【发布时间】:2013-07-07 02:14:43
【问题描述】:

我收到的错误不一致,

  1. 成功执行服务方法后(服务和客户端之间的数据传递)

  2. 同时执行服务方法本身。

  3. 如果我们使用低数据 [CSV 和 DB 中的数千个数据],它将执行 而不 导致任何问题

我在 google 上尝试了很多配置文件,如果需要检查 IIS 级别,请帮助我。

场景:

我上传文件 (CSV),其中包含 1,00,000 (10 万) 条记录 & DB 也包含 10 万条记录 & 要求是将 csv 的每条记录与 DB 记录进行比较并给出合并的输出是记录是不同的(通过比较每个字段)。

客户端到服务:文件通过字节格式传输 对客户端的服务: 集合对象 [通用列表格式]

使用的技术和代码 实体 framework-4 用于获取初始记录。 使用正常的 foreach/for 循环进行比较。 用于现场比较的开关。 WCF、Silverlight、c# 和 .Net 4.5

以下是我的设置,

服务配置:

    <basicHttpBinding>
    <binding name="basicHttpBinding_IUploadService" maxBufferPoolSize="2147483647" closeTimeout="00:45:00"
              openTimeout="00:45:00" receiveTimeout="00:45:00" sendTimeout="00:45:00" maxBufferSize="2147483647"
                        maxReceivedMessageSize="2147483647">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <security mode="Transport">
                <transport clientCredentialType="None" proxyCredentialType="None"
                  realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
    </basicHttpBinding>

<service name="Namespace.UploadService">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_IUploadService"
           contract="Namespace.IUploadService" >
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>

<behavior name="">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <ServiceErrorBehaviour/>

</behavior>

客户端配置:

<binding name="BasicHttpBinding_IUploadService" closeTimeout="00:45:00"
          openTimeout="00:45:00" receiveTimeout="00:45:00" sendTimeout="00:45:00"
          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="Transport" />
</binding>

<endpoint address="https://localhost/URL/Upload.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUploadService"
        contract="UploadService.IUploadService" name="BasicHttpBinding_IUploadService" />

网络配置:

<system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <authentication mode="Windows"/>
    <httpRuntime maxRequestLength="2147483647" executionTimeout="2700" enableVersionHeader="false"/>
    <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/>
  </system.web>

错误:

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__DisplayClassa.<EndGetResponse>b__9(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace --- & ...

字节大小 客户端到服务器(输入): 10Mb [以字节格式] & 服务器到客户端(输出):如果它的数量很少,那么很好,否则问题[期望超过输入大小]

也使用 https 不是 http

谢谢, S.Venkatesh

【问题讨论】:

    标签: c# wcf silverlight entity-framework-4 .net-4.5


    【解决方案1】:

    如果 WCF 抛出错误,Silverlight 总是抛出 NotFound,因为 HTTP 响应代码将是 500:此错误代码强制 Silverlight 抛出 NotFound。

    因此,首先尝试在执行此调用时调试 WCF。 如果您不能这样做,请让 WCF 在某处记录错误。 如果您希望在 silverlight 端引发相应的错误,则必须使用服务器 WCF 行为,即使发生错误,WCF 也会使用 200 代码回答。

    更多信息在这里: http://msdn.microsoft.com/en-us/library/ee844556(v=vs.95).aspx

    【讨论】:

      【解决方案2】:

      我过去也遇到过类似的错误,大多数时候是 WCF 服务失败:例如一些与通信部分无关的异常。

      如果可以调试 WCF 服务本身;或者,您可以使用以下实用程序设置跟踪并确保 WCF 正确返回调用:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2023-03-30
        • 2012-08-31
        • 2023-03-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-22
        相关资源
        最近更新 更多