web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Unanswered

Microsoft.Dynamics.Commerce.RetailProxy.IProductManager.Search - no response after 10 requests

(0) ShareShare
ReportReport
Posted on by 2
We are making up to 1000 individual and consecutive requests to Microsoft.Dynamics.Commerce.RetailProxy.IProductManager.Search with a barcode as ProductSearchCriteria to get RecoridId for each barcode. 
 
This has worked until we upgraded to v10.0.39 and now the 11th request hangs and gets no response. We send the requests and get response for 10 products and then on the request for the 11th it does not give any response, its just stuck.
 
However, when I tried to debug with Fiddler it started working and it could send 1000 request as expected. This led me to find this https://www.telerik.com/blogs/help!-running-fiddler-fixes-my-app- and it sounds like its the first type of issue mentioned here. /Ensure you always call Close() on the result of a call to GetResponseStream()./ 
 
So how can I assure that the stream or connection is closed correctly when Im using the refrences from Microsoft.Dynamics.Commerce.RetailProxy.IProductManager?
 
private async Task<Microsoft.Dynamics.Commerce.RetailProxy.Product> SearchForProductUsingBarcode(string barcode){    try    {        var productManager = await _managerFactory.GetManagerWithServerContext<IProductManager>();        var products = await productManager.Search(            new ProductSearchCriteria            {                Context = new ProjectionDomain { ChannelId = _retailServerSettings.ChannelId },                Barcodes = new ObservableCollection<string>                {                    barcode                }            },            new QueryResultSettings            {                Paging = new PagingInfo                {                    Skip = 0,                    Top = 1                },                Sorting = new SortingInfo()            }        );        return products?.FirstOrDefault();    }    catch (Exception ex)    {        Log.Error($/Error in SearchForProductUsingBarcode/, ex);        return default;    }}        public async Task<TManager> GetManagerWithServerContext<TManager>() where TManager : RetailProxyModels.IEntityManager        {            var context = await _retailContextFactory.CreateServerContextAsSystem();            return InternalGetManager<TManager>(context);        }        private TManager InternalGetManager<TManager>(RetailProxyModels.RetailServerContext context)            where TManager : RetailProxyModels.IEntityManager        {            return _container                .With((RetailProxyModels.IContext)context)                .GetInstance<TManager>();        }        public async Task<RetailServerContext> CreateServerContextAsSystem()        {            var accessToken = await _confidentialClientApplication.AcquireTokenForClient(scopes: new[] { $/{_retailServerSettings.Resource}/.default/ }).ExecuteAsync();                        return RetailServerContext.Create(                _retailServerSettings.RetailServerEndpoint,                _retailServerSettings.OperatingUnitNumber,                new ClientCredentialsToken(accessToken.AccessToken)            );        }
 
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 865

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 289 Super User 2025 Season 2

#3
Sagar Suman Profile Picture

Sagar Suman 230 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans