我有一个WCF服务,它作为Windows服务托管,由客户端通过代理类调用 . 代理类中的方法如下所示:
public CustomerResponse GetCustomers(CustomerRequest request)
{
try
{
return Channel.GetCustomers(request);
}
catch (Exception ex)
{
throw ex;
}
}
GetCustomer目前从我的数据库返回大约1000条记录 . 问题是这样的:
-
我在4台不同的PC上运行了我的程序,我只在其中2台上出现了这个错误 . 其他两个都很好,都具有相同的设置
-
在出现此问题的2台PC上,当我将数据库中的客户记录数量从1000降低到200时,问题得以解决 .
-
我已经完成了配置文件中我所知道的所有设置
这是异常消息
套接字连接已中止 . 这可能是由于处理消息的错误或远程主机超出接收超时或基础网络资源问题引起的 . 本地套接字超时为'00:00:59.9863281' .
我非常确定这不是一个超时问题,因为异常会在不到一秒的时间内返回 .
这是我在服务器上的配置文件
<services>
<service name="CustomerService" behaviorConfiguration="DefaultBehaviour">
<endpoint address="CommonService" binding="netTcpBinding" bindingConfiguration="customTcpBinding"
contract="ICustomerService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8542/CustomerService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehaviour">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
这是MVC项目中的配置文件
<bindings>
<netTcpBinding>
<binding name="customTcpBinding" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
<security mode="None"/>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>
</netTcpBinding>
</bindings>
<endpoint address="net.tcp://localhost:8542/CustomerService" binding="netTcpBinding" bindingConfiguration="customTcpBinding" contract="ICustomerService" name="NetTcpBinding_CustomerService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>