20904 (2) [Avatar] Offline
#1
I'm getting an error when bootstrapping the code from chapter 9. Seem like Nancy isn't finding the ClientFactory when starting up..

InnerException: 
                                HResult=-2146233088
                                Message=Unable to resolve type: ShoppingCart.ProductCatalogClient
                                Source=Nancy
                                StackTrace:
                                     at Nancy.TinyIoc.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
                                     at Nancy.TinyIoc.TinyIoCContainer.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
                                     at Nancy.TinyIoc.TinyIoCContainer.SingletonFactory.GetFactoryForChildContainer(Type type, TinyIoCContainer parent, TinyIoCContainer child)
                                     at Nancy.TinyIoc.TinyIoCContainer.GetParentObjectFactory(TypeRegistration registration)
                                     at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
                                     at Nancy.TinyIoc.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
                                InnerException: 
                                     HResult=-2146233088
                                     Message=Unable to resolve type: ShoppingCart.RestClientFactory
                                     Source=Nancy
                                     StackTrace:
                                          at Nancy.TinyIoc.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
                                          at Nancy.TinyIoc.TinyIoCContainer.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options)
                                          at Nancy.TinyIoc.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options)
                                          at Nancy.TinyIoc.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options)
c.horsdal (64) [Avatar] Offline
#2
Have you remembered to register the `IRestClientFactory` with the container in your boostrapper? (see listing 9.10 IIRC)
20904 (2) [Avatar] Offline
#3
c.horsdal wrote:Have you remembered to register the `IRestClientFactory` with the container in your boostrapper? (see listing 9.10 IIRC)


I downloaded the code and just ran it in VS.
200579 (1) [Avatar] Offline
#4
Startup file
[ 270 KB ]
Error in PS
[ 165 KB ]
I'm having the same issue. The download for code, and the github repo, do not have the httpclient injected into the productCatlogueClient's constructor as it is shown in the book fig 9.12. When I try to put in the code from the book, I'm getting the TinyIOC error that it can't resolve it in the product catalogue client.

Also, since RequestProductFromProductCatalogue is static, you can't access this.httpClientFactory.Create(new Uri(productCatalogueBaseUrl)) as you would have to new one up.

I'm also interested in how the httpClient could be made a singleton instead of newing one up each request and still get the benefit of the correlation token.

Attached some screenshots. Please let me know if you need any other files, etc. Again, thanks in advance for the help.

Otherwise the book has been great so far!