無法從Visual Studio運行Sitecore Commerce Engine和插件


0

我正在使用sitecore XC 9.2,並嘗試按照此處提到的過程https://medium.com/@siddharaju.s/debugging-sitecore-commerce-engine-custom-plugins-948a6b50e27f從Visual Studio運行商務引擎項目。

項目運行成功,我在控制台窗口中收到消息,它正在偵聽端口5000。

在停止CommerceAuthoringRole並運行了業務工具之後,我在控制台中收到以下有關CORS請求的錯誤。我在config.json文件中設置了" AntiForgeryEnabled":false。Console Error

0

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


0

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