0
我試圖通過WCF服務獲取對象列表。一些簡單的方法很好。但是,當我嘗試獲取對象列表調用Wcf函數時,套接字連接中止
我收到以下錯誤。
錯誤:套接字連接被中止。這可能是由處理您的消息時出錯或遠程主機超出接收超時或基礎網絡資源問題引起的。本地套接字超時爲'00:59:59.9949990'。 錯誤:一個現有的連接被強行遠程主機
這裏關閉是客戶端配置
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_ISurveyService" sendTimeout="00:05:00"
maxBufferPoolSize="20000000" maxBufferSize="20000000" maxReceivedMessageSize="20000000">
<readerQuotas maxDepth="32" maxStringContentLength="200000000"
maxArrayLength="200000000" />
</binding>
<binding name="NetTcpBinding_ISurveyService1" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8523/SurveyService" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_ISurveyService" contract="SurveyApp.SurveyService.ISurveyService"
name="NetTcpBinding_ISurveyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="net.tcp://localhost:8523/SurveyService" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_ISurveyService1" contract="ServiceReference.ISurveyService"
name="NetTcpBinding_ISurveyService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
這是服務庫配置:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_ISurveyService" openTimeout="00:10:00"
closeTimeout="00:10:00"
sendTimeout="00:10:00"
receiveTimeout="00:10:00"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000" />
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="WcfServiceLibrary1.Service1Behavior"
name="SurveyApp.SurveyService.SurveyService">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_ISurveyService"
contract="SurveyApp.SurveyService.ISurveyService" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8523/SurveyService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfServiceLibrary1.Service1Behavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
這是我的服務合同:
[ServiceContract]
public interface ISurveyService
{
[OperationContract]
string GetData(int value);
[OperationContract]
IEnumerable<Question> GetAllQuestions();
[OperationContract]
Test GetElement();
}
而這是數據連續ract class
public partial class Question
{
public Question()
{
this.QuestionOptions = new HashSet<QuestionOption>();
}
[DataMember]
public int Id { get; set; }
[DataMember]
public string Description { get; set; }
[DataMember]
public virtual ICollection<QuestionOption> QuestionOptions { get; set; }
}
感謝您的幫助。
它看起來像服務器無法處理該呼叫。 WCF日誌包含什麼? –