2

I am using sitecore XC 9.2 and trying to run the commerce engine project from Visual Studio following the process mentioned here: https://medium.com/@siddharaju.s/debugging-sitecore-commerce-engine-custom-plugins-948a6b50e27f.

The project run is successful and I am receiving the message in console window that it is listening to port 5000.

After stopping the CommerceAuthoringRole and running the business tools, I receive the below error in console which is about the CORS request. I have set the "AntiForgeryEnabled": false in config.json file. Console Error

2 Answers 2

1

Looks like business tools is still trying to fetch data from the old authoring url. Try again after app pool recycle and refreshing the browser cache.

If it still doesn't work, then verify the following:

Have you changed the config under business tools?

  1. Open \businesstoolsfolder\assets\config.json. Verify the EngineUri (Case sensitive)
  2. If that is correct, verify the config.json of your Visual Studio CE project. Check the AllowedOrigins section and see if it has the right business tools url.
  3. Restart IIS.
  4. Refresh your browser cache

If it still doesn't work try:

  1. Open the identity server folder in inetpub and goto the file--> SitecoreIdentityServer\Config\Production\Sitecore.Commerce.IdentityServer.Host.xml

  2. Verify AllowedCORSOrigins setting. Check entry under AllowedCorsOriginsGroup2. It should have an entry for localhost:5000 combination. it is also case sensitive

2
1

The steps mentioned by @sc.kautilya should be the first thing to look at and it should more or less solve the issue. The detailed steps that I followed were:

1. Sitecore.Commerce.IdentityServer.Host.xml [SitecoreIdentityServer\Config\Production\Sitecore.Commerce.IdentityServer.Host.xml] :

Look for the AllowedCORSOrigins setting. My configuration had multiple nodes of <AllowedCorsOriginsGroup2> with the same values (precisely 18 nodes). I removed the duplicates. Final values:

<AllowedCorsOrigins><AllowedCorsOriginsGroup1>https://localhost:4200|https://localhost:5000</AllowedCorsOriginsGroup1><AllowedCorsOriginsGroup2>https://bizfx.sc9.com|https://commerceauthoring.sc9.com</AllowedCorsOriginsGroup2></AllowedCorsOrigins>

2. config.json for Business Tools [SitecoreBizFx\assets]

  • EngineUri: Original value: https://commerceauthoring.sc9.com & I changed it to: https://localhost:5000

3. Sitecore.Commerce.Engine.Connect.config [website(sc92.dev.local)\App_Config\Include\Y.Commerce.Engine]

  • shopsServiceUrl: Original value: https://commerceauthoring.sc9.com/api/ & I changed it to: https://localhost:5000/api/

  • commerceOpsServiceUrl: Original value: https://commerceauthoring.sc9.com/commerceops/ & I changed it to: https://localhost:5000/commerceops/

  • certificateThumbprint: Original value: Thumbprint of the certificate installed with XC installation & I changed it to: Thumbrpint of my localhost.pfx certificate residing in the wwwroot of my engine folder

Most Important: Restart IIS; Clear App pool of BizFx and clear the browser cache after all these steps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.