Try our conversational search powered by Generative AI!

Unauthorized (401) after commerce update

Vote:
 

I have updated commerce packages to 13.25.0 and after trying to launch the site I see the following exception on any page:

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:

[No relevant source lines]


Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\d422b734\41cf754\App_global.asax.de7gtpr-.0.cs    Line: 0

Stack Trace:

[WebException: The remote server returned an error: (401) Unauthorized.]
   System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +819
   System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) +47
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.ServiceBus.Messaging.<OnRunAsync>d__5.MoveNext() +2441
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   Microsoft.ServiceBus.Messaging.<RunAsync>d__34.MoveNext() +1478

[UnauthorizedAccessException: The remote server returned an error: (401) Unauthorized. InvalidSignature: The token has an invalid signature. TrackingId:08857315-18e9-4ce0-8eab-d09641179155_G1, SystemTracker:myservicebus.servicebus.windows.net:MySiteEvents, Timestamp:2020-10-24T22:53:23]
   Microsoft.ServiceBus.Messaging.<RunAsync>d__34.MoveNext() +2922
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.ServiceBus.<RunAsync>d__8.MoveNext() +450
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +32
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62
   Microsoft.ServiceBus.Common.TaskHelpers.CompleteSynchronously(Task`1 task) +109
   EPiServer.Azure.Events.Internal.DefaultServiceBusSetup.CreateTopic(String connectionString, String topicName, Boolean enablePartitioning, Boolean enableExpressQueues, CancellationToken cancellationToken) +281
   EPiServer.Azure.Events.AzureEventProvider.InitializeServiceBusConnection() +1430
   System.Threading.Tasks.Task.Execute() +71

[AggregateException: One or more errors occurred.]
   System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +4593189
   System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +13992992
   System.Threading.Tasks.Task.Wait(TimeSpan timeout) +64
   System.Threading.Tasks.Task`1.InnerInvoke() +40
   System.Threading.Tasks.Task.Execute() +71

[AggregateException: One or more errors occurred.]
   System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken) +1264
   EPiServer.Events.EventsInitialization.InitializeEvents(ISiteSecretManager siteSecretManager, IEventSiteRegistry eventSiteRegistry, EventProviderService eventProviderService) +340
   System.Threading.Tasks.Task.Execute() +71

[AggregateException: One or more errors occurred.]
   System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) +4593189
   System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) +13992992
   EPiServer.Events.<>c__DisplayClass6_0.<Initialize>b__1(Object sender, EventArgs args) +45

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +132
   System.Delegate.DynamicInvokeImpl(Object[] args) +160
   EPiServer.Framework.Initialization.InitializationEngine.OnInitComplete() +263
   EPiServer.Framework.Initialization.InitializationEngine.ExecuteTransition(Boolean continueTransitions) +208
   EPiServer.Framework.Initialization.InitializationModule.EngineExecute(HostType hostType, Action`1 engineAction) +423
   EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +226
   EPiServer.Global..ctor() +42
   Flugger.Web.Global..ctor() +43
   ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\d422b734\41cf754\App_global.asax.de7gtpr-.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) +142
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +107
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1476
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +186
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +80
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +182
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +724

What causes this error and how to mitigate that?

#229835
Oct 24, 2020 23:00
Vote:
 

Hi Sergey

It looks like your ServiceBus connnection string (named EPiServerAzureEvents) was affected somehow. It could be because the update or something else.

You may want to verify the connection string against the one from the Azure portal.

#229858
Oct 25, 2020 20:18
* 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.