uCommerce API Outside the Web Context - Error on setup the project
I've tried to expose uCommerce API outside the web context. I've created a new solution and follow the recommendations from Enable the uCommerce E-commerce API Outside the Web Context, but using latest binaries and configuration files. All went good until I found this error and I couldn't continue:
An exception of type 'Castle.MicroKernel.ComponentActivator.ComponentActivatorException' occurred inCastle.Windsor.DLL but was not handled in user code Additional information: could not instantiate UCommerce.EntitiesV2.Repository`1[[UCommerce.EntitiesV2.Product, UCommerce, Version=3.0.0.12278, Culture=neutral, PublicKeyToken=null]] Source=Castle.Windsor
This exception occurs in the first line of the sample:
var productList = Product.All().FirstOrDefault();
The application is a console application and it has defined all standard uCommerce settings. I have followed the other discussions and made sure the DLLs are all updates, referenced and copied to the Bin folder.
Actually I did more configurations, but one of them which was not obvious was to add a post build event to my library to copy all the output binaries in the hosting application. As a design, I have an Windows service application and entire logic to access uCommerce is hosted in a DLL. I've added below a sample:
ComponentActivator: could not instantiate UCommerce.EntitiesV2.Repository`1[[UCommerce.EntitiesV2.Product, UCommerce, Version=3.0.0.12320, Culture=neutral, PublicKeyToken=null]]
uCommerce API Outside the Web Context - Error on setup the project
I've tried to expose uCommerce API outside the web context. I've created a new solution and follow the recommendations from Enable the uCommerce E-commerce API Outside the Web Context, but using latest binaries and configuration files. All went good until I found this error and I couldn't continue:
This exception occurs in the first line of the sample:
var productList = Product.All().FirstOrDefault();
The application is a console application and it has defined all standard uCommerce settings. I have followed the other discussions and made sure the DLLs are all updates, referenced and copied to the Bin folder.
Could you please help ?
Issue was resolved and it was due to an missing configuration in the app.config
Thanks for being awesome and posting the follow-up here! #h5yr!
Hi Peter, can you please tell us which configuration was missing. I have been facing this almost all day!
Thanks,
Fabio
Hi Fabio,
Actually I did more configurations, but one of them which was not obvious was to add a post build event to my library to copy all the output binaries in the hosting application. As a design, I have an Windows service application and entire logic to access uCommerce is hosted in a DLL. I've added below a sample:
XCOPY "$(ProjectDir)bin\debug\*.*" "$(SolutionDir)ServiceWeb\bin\Debug\*.*" /Y
To be able to better help you, please be more specific and add error details.
Thanks,
Peter
Hi Peter,
Thanks for taking the time to help.
I described my problem here: http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/37414-uCommerce-can't-instantiate-product-catalog
If you can help, please let me know and thanks!
Fabio
Hi Peter/Soren/Fabio,
I follow your solution. But i still facing a same error. Can anyone give idea?
Below my coding was posted.
App Config:
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
<configSections>
<sectionGroup name="commerce" type="System.Configuration.ConfigurationSectionGroup">
<section name="catalogConfiguration" type="UCommerce.Infrastructure.Configuration.CatalogConfigurationSection" />
<section name="runtimeConfiguration" type="UCommerce.Infrastructure.Configuration.RuntimeConfigurationSection" />
<section name="securityConfiguration" type="UCommerce.Infrastructure.Configuration.SecurityConfigurationSection" />
<section name="amazonPaymentMethodService" type="UCommerce.Transactions.Payments.Amazon.Configuration.AmazonPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="authorizedotnetPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.AuthorizedotnetPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="braintreePaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.BraintreePaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="dibsPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.DibsPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="ePayPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.EPayPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="eWayPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.EWayPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="googleCheckoutPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.GoogleCheckoutPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="idealIngPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.IdealIngPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="multiSafepayPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.MultiSafepayPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="ogonePaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.OgonePaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="payerPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.PayerPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="payExPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.PayExPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="payPalPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.PayPalPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="sagePayPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.SagePayPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
<section name="worldPayPaymentMethodService" type="UCommerce.Transactions.Payments.Configuration.WorldPayPaymentMethodServiceConfigurationSection, UCommerce.Transactions.Payments" requirePermission="false" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="ucommerce" connectionString="server=192.168.1.9;database=MyLocalDB;user id=sa;password=kbs" providerName="System.Data.SqlClient" />
</connectionStrings>
<commerce>
<runtimeConfiguration enableCache="true" cacheProvider="NHibernate.Caches.SysCache2.SysCacheProvider, NHibernate.Caches.SysCache2" connectionString="(auto)" />
<catalogConfiguration defaultCultureCode="en-US" enforceCategoryNameUniquenessWithinCatalogs="true" />
<securityConfiguration enable="true" />
<amazonPaymentMethodService configSource="configuration\payments\Amazon.config" />
<authorizedotnetPaymentMethodService configSource="configuration\payments\Authorizedotnet.config" />
<braintreePaymentMethodService configSource="configuration\payments\Braintree.config" />
<dibsPaymentMethodService configSource="configuration\payments\Dibs.config" />
<ePayPaymentMethodService configSource="configuration\payments\ePay.config" />
<eWayPaymentMethodService configSource="configuration\payments\eWay.config" />
<googleCheckoutPaymentMethodService configSource="configuration\payments\GoogleCheckout.config" />
<idealIngPaymentMethodService configSource="configuration\payments\Ideal-Ing.config" />
<multiSafepayPaymentMethodService configSource="configuration\payments\MultiSafepay.config" />
<ogonePaymentMethodService configSource="configuration\payments\Ogone.config" />
<payerPaymentMethodService configSource="configuration\payments\Payer.config" />
<payExPaymentMethodService configSource="configuration\payments\PayEx.config" />
<payPalPaymentMethodService configSource="configuration\payments\PayPal.config" />
<sagePayPaymentMethodService configSource="configuration\payments\SagePay.config" />
<worldPayPaymentMethodService configSource="configuration\payments\WorldPay.config" />
</commerce>
</configuration>
This is my bin folder:
My post event
XCOPY "$(ProjectDir)bin\debug\*.*" "$(SolutionDir)Project.Web\bin\*.*" /Y
My Bug was:
ComponentActivator: could not instantiate UCommerce.EntitiesV2.Repository`1[[UCommerce.EntitiesV2.Product, UCommerce, Version=3.0.0.12320, Culture=neutral, PublicKeyToken=null]]
Please give some idea.
Thanks
Vignesh D
I posted a new version of the article with specific instrucutions for uCommerce 3: Using the uCommerce 3 API in a Windows Application.
Hope this helps.
is working on a reply...