System.net.http.httprequestexception Error while copying content to a stream' on 401 API Response
-
Hi, I have a web API method and it returns IEnumerable. Cases is a wrapper class of "Proc" Class. I am consuming this web API from my client. If Proc has count 0, I can able to get data in my client from Web API. When Proc has value (greater than count 0), I get error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host". I am working in VS 2017 and .Net Core 2.1 Please advise Cases.cs public partial class Cases { public CaseDetails() { CaseProcedures = new HashSet(); } public int Id { get; set; } public int UniqueNumber { get; set; } public HashSet Proc { get; set; } } Proc.cs public partial class Proc { public int Id { get; set; } public int CasesId { get; set; } }
Balasubramanian K.
-
Hi, I have a web API method and it returns IEnumerable. Cases is a wrapper class of "Proc" Class. I am consuming this web API from my client. If Proc has count 0, I can able to get data in my client from Web API. When Proc has value (greater than count 0), I get error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host". I am working in VS 2017 and .Net Core 2.1 Please advise Cases.cs public partial class Cases { public CaseDetails() { CaseProcedures = new HashSet(); } public int Id { get; set; } public int UniqueNumber { get; set; } public HashSet Proc { get; set; } } Proc.cs public partial class Proc { public int Id { get; set; } public int CasesId { get; set; } }
Balasubramanian K.
Yeah, you do know that a 401 code is an authorization failure, I trust. The W3C is your friend! The HTTP 1.1 status codes apply to 1.2 as well. [HTTP/1.1: Status Code Definitions](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)
"Never attribute to malice that which can be explained by stupidity." - Hanlon's Razor