I have a service that is being hosted as a Windows Service and hook up to a Redis server being part of a Message Queue and works great…
I’ve now an API that, instead of passing the order through all steps in the MQ I need the answer right away, so I tried to synchronously call the MQ Services, but I’m getting a null exception with trying to resolve the service:
All I did was to reference the Service and Model projects and call ResolveService…
Am I forgetting something obviously?
The MQ Service is as such:
public class GiftcardCreatorService : BaseService
{
public object Any(GiftcardCreatorMessage message, bool onlyThisStep = false)
{
// ...
}
}
public abstract class BaseService : ServiceStack.Service
{
// ...
}
I can easily create a WebHost project to host the GiftcardCreatorService and use JsonServiceClient to call it, and I know it works fine as I use that in other places, but I was wondering if I could easily call and re-use that MQ step code…
public class GiftcardCreatorService : BaseService
{
public object Any(GiftcardCreatorMessage message)
{
// ...
}
}
And you’re still getting null from ResolveService<GiftcardCreatorService>? Strange, it doesn’t sound like your Service is being registered, Is the Service in the same Assembly as your other Services in your AppHost?
public class AppHost : AppHostBase
{
public AppHost()
: base("Service Name", typeof(MessageQueue.Service.Services.AServiceType).Assembly) {}
}
If it’s not in the Assemblies registered in your AppHost it wont be registered.