user1477388
user1477388

Reputation: 21440

Missing DLLs for ServiceStack

I have a TestClient app based on code taken from here.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security;
using System.Net;
using ServiceStack.Common.Web;
using ServiceStack.Logging;
using ServiceStack.ServiceHost;
using ServiceStack.ServiceInterface;

namespace TestClient
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var client = new JsonServiceClient(); // missing assembly reference

                client.LocalHttpWebRequestFilter +=
                    delegate(HttpWebRequest request)
                    {
                        // ContentType still null at this point so we must hard code it
                        request.ContentType = ServiceStack.Common.Web.ContentType.Json;
                        request.Date = DateTime.Now;

                        var secret = "5771CC06-B86D-41A6-AB39-9CA2BA338E27";
                        var token = ApiSignature.CreateToken(request, secret);
                        request.Headers.Add(ApiCustomHttpHeaders.UserId, "1");
                        request.Headers.Add(ApiCustomHttpHeaders.Signature, token);
                    };


                var teams = client.Get<List<Team>>("http://localhost:59833/api/teams");
                foreach (var team in teams)
                {
                    Label1.Text += team.Name + "<br>";
                }
            }
            catch (WebServiceException ex) // missing assembly reference
            {
                Label1.Text = ex.Message + " : " + ex.ResponseBody;
            }
        }
    }
}

I appear to be missing assembly references for the following:

JsonServiceClient
WebServiceException

Can anyone tell me where I can get these DLLs so that I can complete a build?

Upvotes: 2

Views: 1689

Answers (1)

Ufuk Hacıoğulları
Ufuk Hacıoğulları

Reputation: 38508

You may be missing ServiceStack.Common or ServiceStack.Interfaces. Just install ServiceStack.Common package from NuGet and it will add those references correctly.

You also need this statement:

using ServiceStack.ServiceClient.Web;

Upvotes: 3

Related Questions