Server Error in '/' Application when publish to Azure

4 years ago
Hello,

I have copied the source code from one of my previous NopCommerce websites, created another database on Azure and updated the settings.txt file to point to the new database. The only other changes are to the css.

When I run the new site on localhost it works perfect without a hitch but, when i publish from VS to Azure and then browse to the URL i get an error - Server Error in '/' Application. For the life of me I cannot figure this one out and wondering if any one else has experienced this.

I'm using Nop 3.5

Thanks in advance for any help
4 years ago
Hi,

Could you paste the full error message here ? Screenshot would be best.
4 years ago
Hi,

Thanks for your reply. Cannot attach an image so below is the text from the error.

Server Error in '/' Application.
Runtime Error
Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

Thanks
4 years ago
Yes, thank you but I will need the stack trace and the inner exception message to figure out the problem.
4 years ago
Sorry for my ignorance but if it only throws the error when published to Azure, how do I get the stack trace and the inner exception message?
4 years ago
ok sorry for my lack of knowledge - bare with me!

Server Error in '/' Application.
The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.
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.ArgumentException: The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[ArgumentException: The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.]
   System.Data.Entity.Utilities.Check.NotEmpty(String value, String parameterName) +61
   System.Data.Entity.DbContext..ctor(String nameOrConnectionString) +22
   Nop.Web.Framework.<>c__DisplayClass15.<Register>b__9(IComponentContext c) +42
   Autofac.<>c__DisplayClass10`1.<Register>b__f(IComponentContext c, IEnumerable`1 p) +10
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +31
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +185
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +31
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +185
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +31
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +185
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
   Nop.Web.Framework.SettingsSource.<BuildRegistration>b__5(IComponentContext c, IEnumerable`1 p) +35
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44

[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The argument 'nameOrConnectionString' cannot be null, empty or contain only white space. (See inner exception for details.)]
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +108
   Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
   Autofac.ResolutionExtensions.Resolve(IComponentContext context) +46
   Nop.Core.Infrastructure.DependencyManagement.ContainerManager.Resolve(String key, ILifetimeScope scope) +89
   Nop.Core.Infrastructure.NopEngine.Resolve() +55
   FoxNetSoft.Plugin.Misc.RFQ2.UpdateStartUpTask.Execute() +34
   Nop.Core.Infrastructure.NopEngine.RunStartupTasks() +477
   Nop.Core.Infrastructure.NopEngine.Initialize(NopConfig config) +36
   Nop.Core.Infrastructure.EngineContext.Initialize(Boolean forceRecreate) +92
   Nop.Web.MvcApplication.Application_Start() +30

[HttpException (0x80004005): An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The argument 'nameOrConnectionString' cannot be null, empty or contain only white space. (See inner exception for details.)]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9916673
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The argument 'nameOrConnectionString' cannot be null, empty or contain only white space. (See inner exception for details.)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36215
4 years ago
Hi,

There is something wrong with your connection string. Maybe this will help you figure out where exactly the problem is.

The connection string could be found in App_Data/Settings.txt
4 years ago
And of course i will compile again in debug mode!  ;)
4 years ago
Thanks will look into it
4 years ago
Zac.Hall wrote:
ok sorry for my lack of knowledge - bare with me!

Server Error in '/' Application.
The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.
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.ArgumentException: The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[ArgumentException: The argument 'nameOrConnectionString' cannot be null, empty or contain only white space.]
   System.Data.Entity.Utilities.Check.NotEmpty(String value, String parameterName) +61
   System.Data.Entity.DbContext..ctor(String nameOrConnectionString) +22
   Nop.Web.Framework.<>c__DisplayClass15.<Register>b__9(IComponentContext c) +42
   Autofac.<>c__DisplayClass10`1.<Register>b__f(IComponentContext c, IEnumerable`1 p) +10
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +31
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +185
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +31
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +185
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.Core.Activators.Reflection.<>c__DisplayClass2.<CanSupplyValue>b__0() +31
   Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +94
   Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +185
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.InstanceLookup.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +24
   Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
   Nop.Web.Framework.SettingsSource.<BuildRegistration>b__5(IComponentContext c, IEnumerable`1 p) +35
   Autofac.Builder.<>c__DisplayClass1`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p) +14
   Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters) +32
   Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters) +48
   Autofac.Core.Resolving.InstanceLookup.<Execute>b__0() +8
   Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator) +120
   Autofac.Core.Resolving.InstanceLookup.Execute() +132
   Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters) +133
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +44

[DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The argument 'nameOrConnectionString' cannot be null, empty or contain only white space. (See inner exception for details.)]
   Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters) +112
   Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters) +108
   Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance) +74
   Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters) +54
   Autofac.ResolutionExtensions.Resolve(IComponentContext context, IEnumerable`1 parameters) +118
   Autofac.ResolutionExtensions.Resolve(IComponentContext context) +46
   Nop.Core.Infrastructure.DependencyManagement.ContainerManager.Resolve(String key, ILifetimeScope scope) +89
   Nop.Core.Infrastructure.NopEngine.Resolve() +55
   FoxNetSoft.Plugin.Misc.RFQ2.UpdateStartUpTask.Execute() +34
   Nop.Core.Infrastructure.NopEngine.RunStartupTasks() +477
   Nop.Core.Infrastructure.NopEngine.Initialize(NopConfig config) +36
   Nop.Core.Infrastructure.EngineContext.Initialize(Boolean forceRecreate) +92
   Nop.Web.MvcApplication.Application_Start() +30

[HttpException (0x80004005): An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The argument 'nameOrConnectionString' cannot be null, empty or contain only white space. (See inner exception for details.)]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9916673
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): An exception was thrown while executing a resolve operation. See the InnerException for details. ---> The argument 'nameOrConnectionString' cannot be null, empty or contain only white space. (See inner exception for details.)]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.36215


Hi Zac,

It seems there is problem on your connection string. Plesae check it.