Upgrade to BE 2.5 fails on web hoster

Aug 28, 2011 at 1:48 PM

When I upload my upgraded blog site to my ASP.NET 4.0 web hoster (I installed a Virtual Directory, gave everyone Write permission on App_Data), I keep getting this error:

What's the issue? And how can I resolve it?? I checked my web.config and I'm pretty sure all my provider-related settings are correct and in place ..... and locally, on my dev box, this site works just fine, in both IISExpress inside VS2010, as well as a full-blown IIS 7.5 site..... any ideas?

 

Exception Details: System.ArgumentException: Expecting non-empty string for 'providerInvariantName' parameter.

Stack Trace:

[ArgumentException: Expecting non-empty string for 'providerInvariantName' parameter.]
   System.Data.Common.ADP.CheckArgumentLength(String value, String parameterName) +2235141
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +23
   BlogEngine.Core.Providers.DbConnectionHelper..ctor(String providerName, String connectionString) +12
   BlogEngine.Core.Providers.DbBlogProvider.CreateConnection() +97
   BlogEngine.Core.Providers.DbBlogProvider.FillBlogs() +73
   BlogEngine.Core.Blog.get_Blogs() +94
   BlogEngine.Core.Blog.get_CurrentInstance() +396
   BlogEngine.Core.Right.EnsureBlogInstanceDataLoaded() +32
   BlogEngine.Core.Right..cctor() +557

[TypeInitializationException: The type initializer for 'BlogEngine.Core.Right' threw an exception.]
   BlogEngine.Core.Right..ctor() +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) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance(Type type, Boolean nonPublic) +69
   System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1136
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
   System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +23
   System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
   System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +196
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1088
   Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleReflectionUtil.GetIntegratedModuleCollection(HttpApplication target, IntPtr appContext) +33
   Microsoft.Web.Infrastructure.DynamicModuleHelper.CriticalStatics.Init(HttpApplication context) +179
   Microsoft.Web.Infrastructure.DynamicModuleHelper.IntegratedDynamicModule.Init(HttpApplication context) +6
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +431
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +194
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +253

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

Coordinator
Aug 30, 2011 at 12:35 PM

See this message.  It sounds like you might not have the "providerName" attribute set for the connection string in your web.config file.

Aug 30, 2011 at 4:39 PM

Ben,

sorry, no - that "obvious" mistake is not the case here....

 <connectionStrings>
    <clear/>
    <add name="BlogEngine" connectionString="Data Source=|DataDirectory|BlogEngine.sdf;" providerName="System.Data.SqlServerCe.4.0" />
  </connectionStrings>

  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SqlServerCe.4.0"/>
      <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.1, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </DbProviderFactories>
  </system.data>

Any other ideas?

Coordinator
Aug 30, 2011 at 5:34 PM
Edited Aug 30, 2011 at 5:35 PM

Did you add SqlCe DLLs to the "/bin" directory? Your host server might not have them installed in GAC and you need local copies pushed to /bin.

Aug 30, 2011 at 9:32 PM

I'm pretty sure my DLL's are all in place, yes. My whole installation works just fine - no problems at all - on my local server. It just simply fails when I upload it to my web hoster :-( and the error message is really not helpful at all.....