how to resolve remote server returned an error: (401) Unauthorized ?

Vote:
 

Hi Team,

I updated commerce to 12.5 after the upgrade I can't able to access the commerce manager backend.I getting below error 

The remote server returned an error: (401) Unauthorized.

Stack Trace: 


[WebException: The remote server returned an error: (401) Unauthorized.]
   System.Net.HttpWebRequest.GetResponse() +1390
   EPiServer.Find.Connection.JsonRequest.GetResponseStream() +161
   EPiServer.Find.Api.Command.GetResponse(IJsonRequest request) +70

[ServiceException: The remote server returned an error: (401) Unauthorized.
Unauthorized]
   EPiServer.Find.Api.Command.GetResponse(IJsonRequest request) +414
   EPiServer.Find.Api.PutMappingCommand.Execute() +136
   EPiServer.Find.ClientConventions.NestedConventions.AddNestedType(Type declaringType, String name) +307
   EPiServer.Find.ClientConventions.<>c__DisplayClass17_0.b__2(Type t) +14
   System.Collections.Generic.List`1.ForEach(Action`1 action) +11702442
   EPiServer.Find.ClientConventions.NestedConventions.MarkAllImplementationsAsNested(Type declaringType, String name) +292
   EPiServer.Find.ClientConventions.NestedConventions.ForInstancesOf(Expression`1 exp) +55
   EPiServer.Find.ClientConventions.NestedConventionItemInstanceWrapper`1.Add(Expression`1 expr) +59
   EPiServer.Find.Commerce.CatalogContentClientConventions.ApplyNestedConventions(NestedConventions nestedConventions) +219
   EPiServer.Find.Commerce.CatalogContentClientConventions.ApplyConventions(IClientConventions clientConventions) +123
   EPiServer.Find.Commerce.FindCommerceInitializationModule.Initialize(InitializationEngine context) +130

[ApplicationException: Could not apply catalog content conventions.
                        The content indexed during this session will not contain important additional fields and searches might work incorrectly, until the site restarts and the conventions are applied successfully.
                        We recommend to fix the following exception, but if you are certain this exception can be safely ignored, add 'episerver:findcommerce.IgnoreWebExceptionOnInitialization' key with value = true to appSettings.]
   EPiServer.Find.Commerce.FindCommerceInitializationModule.HandleInitializationException(Exception exception, Boolean ignoreInitializationError) +126
   EPiServer.Find.Commerce.FindCommerceInitializationModule.Initialize(InitializationEngine context) +171
   EPiServer.Framework.Initialization.Internal.<>c__DisplayClass2_0.b__0() +19
   EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key) +52
   EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context) +80
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +179

[InitializationException: Initialize action failed for Initialize on class EPiServer.Find.Commerce.FindCommerceInitializationModule, EPiServer.Find.Commerce, Version=11.0.1.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7]
   EPiServer.Framework.Initialization.InitializationEngine.InitializeModules() +492
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +153
   EPiServer.Framework.Initialization.InitializationEngine.Initialize() +40
   EPiServer.Framework.Initialization.<>c.b__7_0(InitializationEngine e) +9
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +460
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +170
   EPiServer.Global..ctor() +43
   ASP.global_asax..ctor() in c:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\root\0d233221\d25df42c\App_global.asax.gjcfw14h.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +119
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1117
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +20
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +263
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9922840
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
</></></>

Below one is my web.config.Please let me know any config changes needed.

  

Please help me out,

Advance Thanks,

#195695
Edited, Aug 04, 2018 17:25
Vote:
 

It is a well formatted and detailed question. Good work. Keep it up.

It seems you accidentally installed FindCommerce toCommerce Manager, when you should not

#195696
Aug 04, 2018 17:33
Vote:
 

Thanks Quan for your quick reply.It works

#195697
Edited, Aug 04, 2018 17:58
Vote:
 

Hi Quan,

I have another problem while loading the Catalog Management-> catalog entry search.Getting similar error 

Server Error in '/' Application.
The remote server returned an error: (401) Unauthorized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The remote server returned an error: (401) Unauthorized.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[WebException: The remote server returned an error: (401) Unauthorized.]
   System.Net.HttpWebRequest.GetResponse() +1390
   EPiServer.Find.Connection.JsonRequest.GetResponseStream() +164
   EPiServer.Find.Api.Command.GetResponse(IJsonRequest request) +70

[ServiceException: The remote server returned an error: (401) Unauthorized.
Unauthorized]
   EPiServer.Find.Api.Command.GetResponse(IJsonRequest request) +414
   EPiServer.Find.Api.SearchCommand`1.Execute() +400
   EPiServer.Find.Client.Search(SearchRequestBody requestBody, Action`1 commandAction) +247
   EPiServer.Find.SearchExtensions.GetResult(ISearch`1 search) +247
   EPiServer.Commerce.FindSearchProvider.FindSearchProvider.Search(String applicationName, ISearchCriteria criteria) +64
   Mediachase.Search.SearchManager.Search(ISearchCriteria criteria) +128
   Mediachase.Commerce.Manager.Catalog.CatalogEntrySearch.BindGrid(Boolean retryOnSearchException) +682
   Mediachase.Commerce.Manager.Catalog.CatalogEntrySearch.CurrentListView_PagePropertiesChanged(Object sender, EventArgs e) +10
   System.Web.UI.WebControls.ListView.OnPagePropertiesChanged(EventArgs e) +91
   System.Web.UI.WebControls.ListView.SetPageProperties(Int32 startRowIndex, Int32 maximumRows, Boolean databind) +135
   System.Web.UI.WebControls.ListView.System.Web.UI.WebControls.IPageableItemContainer.SetPageProperties(Int32 startRowIndex, Int32 maximumRows, Boolean databind) +21
   System.Web.UI.WebControls.DataPager.SetPageProperties(Int32 startRowIndex, Int32 maximumRows, Boolean databind) +55
   Mediachase.Commerce.Manager.Core.Controls.EcfListViewControl.Page_Load(Object sender, EventArgs e) +649
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +95
   System.Web.UI.Control.LoadRecursive() +59
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Control.LoadRecursive() +131
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2952

Regards,

Karthik

#195698
Aug 04, 2018 18:24
Vote:
 

It seems like your Find account isn't active. Can you check find.config, and look for the connection string to Find. It might be that your free demo-index has been removed (it will be removed 30 days after it has been created).

#195699
Aug 04, 2018 22:28
Vote:
 

If you want to use FindSearchProvider, you would need to configure it with a working find index in configs\mediachase.search.config. what is your settings there

#195700
Aug 05, 2018 0:16
Vote:
 

Thanks Quan & Jonas,

Find is working fine only. (project search works well)

I attached our configs\mediachase.search.config below,

<?xml version="1.0" encoding="utf-8"?>
<Mediachase.Search>
  <SearchProviders defaultProvider="FindSearchProvider">
    <providers>
      <!-- SOLR Search Provider - enterprise level search server -->
      <!-- queryBuilderType - specifies class that is used to build the query -->
      <!-- shareCores - if "true" the cores will be shared between applications meaning two different apps will reuse catalog core and store applicationName with the index -->
      <!-- url - URL to a solr server -->
      <add name="SolrSearchProvider" type="Mediachase.Search.Providers.Solr.SolrSearchProvider, Mediachase.Search.SolrSearchProvider" queryBuilderType="Mediachase.Search.Providers.Solr.SolrSearchQueryBuilder, Mediachase.Search.SolrSearchProvider" url="http://localhost:8080/solr" shareCores="true" />
      <!-- Improved SOLR Search Provider (still in development, will replace SolrSearchProvider) -->
      <!-- queryBuilderType - specifies class that is used to build the query -->
      <!-- url - URL to a solr server -->
      <!-- shareCores - if "true" the cores will be shared between applications meaning two different apps will reuse catalog core and store applicationName with the index -->
      <!-- commitWithin - the maximum latency (in milliseconds) between a batch of index updates being sent the the solr engine and the commit operation for those changes. -->
      <!-- maximumBatchSize - the maximum number of indexing commands sent to the solr engine per HTTP post -->
      <add name="Solr35SearchProvider" type="Mediachase.Search.Providers.Solr35.SolrSearchProvider, Mediachase.Search.Solr35SearchProvider" queryBuilderType="Mediachase.Search.Providers.Solr35.SolrSearchQueryBuilder, Mediachase.Search.Solr35SearchProvider" url="http://localhost:8080/solr" shareCores="true" facetLocalizedFieldValuesOnly="true" commitWithin="10000" maximumBatchSize="50" />
      <!-- Lucene Search Provider - file based search library -->
      <!-- queryBuilderType - specifies class that is used to build the query -->
      <!-- storage - specifies directory to store index files -->
      <!-- simulateFaceting - if true, lucene will simulate faceting in the application; if false, faceting will return no results
                (note: simulated faceting is very inefficient, production environments requiring faceting should use solr) -->
      <add name="LuceneSearchProvider" type="Mediachase.Search.Providers.Lucene.LuceneSearchProvider, Mediachase.Search.LuceneSearchProvider" queryBuilderType="Mediachase.Search.Providers.Lucene.LuceneSearchQueryBuilder, Mediachase.Search.LuceneSearchProvider" storage="[appDataPath]\Search\ECApplication\" simulateFaceting="true" />
      
      <add name="FindSearchProvider" type="EPiServer.Commerce.FindSearchProvider.FindSearchProvider, EPiServer.Commerce.FindSearchProvider" serviceUrl="https://es-eu-dev-api01.episerver.net/xxxxxxxxxxxxxxxxxxxxx/" defaultIndex="arthurbitstudios_findindex" />
    </providers>
  </SearchProviders>
  <Indexers basePath="[appDataPath]\Search\ECApplication\">
    <add name="catalog" type="xxx.Core.Index.xxxIndexBuilder, xxx.Core" />
  </Indexers>
</Mediachase.Search>

Please help me out

Regards,

Karthik

#195702
Edited, Aug 05, 2018 15:19
Vote:
 

Did you try to rebuild index first?

#195704
Aug 05, 2018 21:48
Vote:
 

Hi Quan,

We are using the same find index for two more sites for dev and QA,MS purpose. So I can't able to reindex the find now once all my upgrading processes are done then I will start my reindex process. (it is a big process for us we have more than 1.2laxs products)

Is it necessary to reindex the find? (for find ver13 breaking changes mentioned as reindex)

Advance Thanks,

#195711
Edited, Aug 06, 2018 10:39
Vote:
 

By reindex I meant running the rebuild index feature in Commerce Manager. Note that when you useFindSearchProvider for CM and FindCommerce for front end your index will be doubled. they use different ways to index and that is not shared

#195727
Aug 06, 2018 17:21
Vote:
 

Quan I am not aware what type of search used in CM and FindCommerce for front-end in our project. I checked total product count and find index count in the backend the count similarly same only.

How to find what type of search used in CM and Findcommerce front end.Where I can get the rebuild option CM.

 

#195728
Aug 06, 2018 17:59
Vote:
 

karthikeyan,

This page explains how to rebuild the index in Commerce Manager: http://webhelp.episerver.com/latest/commerce/system-administration/updating-a-search-index.htm.

#195731
Aug 06, 2018 18:40
Vote:
 

Thanks Bob,

If clicks rebuild i getting error like below

06-08-18 22:52:58: Build Failed using "catalog" indexer. "Object reference not set to an instance of an object.



#195733
Aug 06, 2018 19:26
Vote:
 

It seems that your xxxIndexBuilder does not inherit from FindSearchIndexBuilder, which is required 

https://world.episerver.com/documentation/Items/Developers-Guide/Episerver-Commerce/8/Search/Configuring-EPiServer-Find-search-provider/

You can use FindSearchIndexBuilder directly, of course 

#195742
Aug 07, 2018 9:24
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.