I have a similar problem as described here. The difference is, that I do NOT get any exception on the client. Since the service has a void
return type, nothing comes back. If I look into fiddler, I see the above error message, but I cannot see an Inner Exception anywhere.
HTTP/1.1 200 OK
Date: Fri, 27 Jul 2018 14:14:21 GMT
Server: Kestrel
Content-Length: 194
Error: Exception: Error trying to resolve Service 'BizBusDataExchangeServer.ServiceInterface.Services.DataExchangeService' or one of its autowired dependencies (see inner exception for details).
It looks like my service method is not called since no breakpoints are hit. (Which seems logic if it cannot find the implementation) But the service should be automatically added to Func since it is a ‘normal’ ServiceStack service, which should be automatically added to Func. The service itself is pretty simple:
public void Post(ImportTopalTenants request)
{
Logger.Debug($"Sending a command to retrieve all tenants from topal server.");
var databaseName = $"{BbDeConstants.SysDbName}{request.PlatformId.ToString()}";
var queryTenantsMsg = new TenantQueryMsg
{
PublisherId = BbDeConstants.MyPublisherId,
MessageId = Guid.NewGuid().ToString(),
QueryMsg = new TenantQueryMsgDto()
};
var platformId = request.PlatformId;
var rk = $"toac-{platformId.ToString()}.queries";
MessageSender.SendMessage(queryTenantsMsg, BbMessageApiConstants.CommandExchange, rk, databaseName, GetSession().UserAuthName);
}
The last line is a call to a static method which sends the created object to RabbitMQ. Inside this method I resolve the RabbitMQ client from the IOC:
//....
try
{
**var bus = HostContext.Resolve<IBus>().Advanced;**
var msg = new Message<T>(message) { Properties = { ContentType = "application/json" } };
msg.Properties.Type = msg.GetType().Name;
var exchange = new Exchange(exchangeName);
bus.Publish(exchange, msgRoutingKey, false, msg);
}
//....
And in my AppHost.cs
I register the client in the AfterInitCallbacks.Add(host => ...
lambda like so:
try
{
var rabbitConnectString = myConfiguration.GetRabbitMqConnectString(rabbitVHost);
var msgBus = RabbitHutch.CreateBus(rabbitConnectString);
**container.Register(msgBus);**
}
catch (Exception ex)
{
Logger.Error(
$"Error connecting to RabbitMQ with connectionString {myConfiguration.GetRabbitMqConnectString(rabbitVHost)}. Error: {ex}");
throw;
}
I also register queue listeners by retrieving the client from the IOC container without any error.
So how can I get more information about this inner exception??
By the way: I get this error with several calls to this service, one returns a strange exeption on the client: Type definitions should start with a '{', expecting serialized type 'MyDataType', got string with: Error:
Any idea how I can get more details about these errors?