runtime: System.InvalidOperationException: Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.

Hello,

I have migarted my project from .NET Framework to .NET Core, and when i call WS i get error

System.InvalidOperationException: Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects. at System.Net.Http.Headers.HttpHeaders.GetHeaderDescriptor(String name) at System.Net.Http.Headers.HttpHeaders.Add(String name, String value)



Cordially

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 32 (9 by maintainers)

Most upvoted comments

You need to set Content to something. The null ref is from your method trying to call something off of the Content property, which will return null until you set it to something non-null.