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

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 142 Super User 2026 Season 1

#2
Abhilash Warrier Profile Picture

Abhilash Warrier 102 Super User 2026 Season 1

#3
Laurens vd Tang Profile Picture

Laurens vd Tang 101 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans