I have REST API service using Servicetack.Service in ServiceStack.AppHost. One of my web services is calling other 3rd party's web service. When it call the 3rd party using HttpClient I get this exception: System.Security.Authentication.AuthenticationException HResult=0x80131501 Message=A call to SSPI failed, Inner Exceptin: Win32Exception: The message received was unexpected or badly formatted. This code is working just fine on ApiController. But I want to migrate my code to use ServiceStack.Service
This is my post method that call to other post http service:
public object Post(MyRequest info)
{
var myJsonRequest = "Building Json from request info....";
using (var cl = new HttpClient())
{
var result = cl.PostAsync("http://3rdpartyurl:999/someservice",
new StringContent(myJsonRequest, Encoding.UTF8, "application/json")).Result;
return result.StatusCode;
}
}
I tried to replace use of HttpClient with WebRequest and JsonServiceClient but I get the same exception.
User contributions licensed under CC BY-SA 3.0