Problem with SQL server provider "Expecting non-empty string for 'providerInvariantName' parameter. "

Topics: ASP.NET 2.0, Business Logic Layer
Oct 21, 2013 at 9:23 AM
Dear Friends,

Did any one face such issue ???
I am getting the below error once I change my blog Default provider to DbBlogProvider.
I am getting the below error.
"Expecting non-empty string for 'providerInvariantName' parameter. "

I have hosted the site, it was working fine, all of the sudden I am facing this issue, I tried changing the connection string an so on.

My Connection string
    <add name="BlogEngine" connectionString="Server=localhost;database=MyBlog;Connection Timeout=30;User id=XXXX;Password=XXXX;" />
Detailed Error Information

[ArgumentException: Expecting non-empty string for 'providerInvariantName' parameter.]
   System.Data.Common.ADP.CheckArgumentLength(String value, String parameterName) +2286529
   System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +23
   BlogEngine.Core.Providers.DbConnectionHelper..ctor(String providerName, String connectionString) in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Providers\DbConnectionHelper.cs:55
   BlogEngine.Core.Providers.DbBlogProvider.CreateConnection() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Providers\DbBlogProvider.cs:3257
   BlogEngine.Core.Providers.DbBlogProvider.FillBlogs() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Providers\DbBlogProvider.cs:437
   BlogEngine.Core.Blog.get_Blogs() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Blog.cs:422
   BlogEngine.Core.Blog.get_CurrentInstance() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Blog.cs:499
   BlogEngine.Core.Right.EnsureBlogInstanceDataLoaded() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Security\Right.cs:547
   BlogEngine.Core.Right..cctor() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Security\Right.cs:111

[TypeInitializationException: The type initializer for 'BlogEngine.Core.Right' threw an exception.]
   BlogEngine.Core.Right..ctor() in c:\rtur\src\Codeplex\be\BlogEngine\BlogEngine.Core\Security\Right.cs:539

[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) +231
   System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1365
   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) +517
   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) +9164848
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +256
Seeking your help friends
Oct 21, 2013 at 9:29 AM
Edited Oct 21, 2013 at 10:14 AM
I think I found the problem, I have missed the provider name, there was a cache in the browser while updating the webconfig

Also I found the complete reason,

I use Windows Hosting, in the windows hosting there is option ASP.net Settings, if you change anything that page, then automatically your web config gets updated (without the providername). So after each update in the asp.net settings please update your web config

Updated Connectionstring which worked for me is
<add name="BlogEngine" providerName="System.Data.SqlClient" connectionString="Data Source=localhost;User ID=usernmae;Password=password;persist security info=False;initial catalog=BlogEngineFileStore;"/>