WCF The underlying connection was closed: An unexpected error occurred on a receive

前端 未结 4 1482
忘掉有多难
忘掉有多难 2021-01-12 02:42

I am using a RestClient app to communicate with my WCF service .and I am getting the following exception

The underlying connection was closed: An unexpected         


        
4条回答
  •  庸人自扰
    2021-01-12 03:13

    Configure WCF tracing in your app.config / web.config and check Error.svclog (it will be created near your binary file) for details. In my case it was because of using Auto-property initializer (property without setter) - a feature from C# 6.0

    No set method for property 'FailedCount' in type 'MyProject.Contracts.Data.SyncStatusByVersion'.
       at System.Runtime.Serialization.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String message, Type type)
                   at WriteSyncStatusByVersionToJson(XmlWriterDelegator , Object , XmlObjectSerializerWriteContextComplexJson , ClassDataContract , XmlDictionaryString[] )
                   ...
    
    

    To configure WCF tracing:

    
        
          
            
              
            
          
          
            
              
            
          
          
            
              
            
          
        
        
          
        
    
    

提交回复
热议问题