Hi I am new to web api 2. I have web api project and mvc project in different solutions. I run web api and run GET in fiddler it works OK . I try POST and I get Error. If I run GET in mvc it runs OK , the POST return error:
No connection could be made because the target machine actively refused it 127.0.0.1:64189.
When I use my DAL directly in mvc app I can post to database without problem.
This is my app in Fiddler :
POST http://localhost:63292/api/blogs HTTP/1.1
User-Agent: Fiddler
Host: localhost:63292
Content-Length: 30
{
"Url":"http://testing.com"
}
HTTP/1.1 415 Unsupported Media Type
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?QzpcV2ViQXBpXFByb2R1Y3RBcHBcUHJvZHVjdEFwcFxhcGlcYmxvZ3M=?=
X-Powered-By: ASP.NET
Date: Tue, 28 May 2019 12:45:37 GMT
Content-Length: 794
{"Message":"The request contains an entity body but no Content-Type header. The inferred media type 'application/octet-stream' is not supported for this resource.","ExceptionMessage":"No MediaTypeFormatter is available to
read an object of type 'Blog' from content with media type 'application/octet-stream'.","ExceptionType":"System.Net.Http.UnsupportedMediaTypeException","StackTrace":" at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent
content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1
formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken)"}