Bug #44654 Unable to initialize provider. Missing or incorrect schema.
Submitted: 4 May 2009 22:47 Modified: 11 May 2011 16:10
Reporter: Thiago Sayao Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.0.3 OS:Windows
Assigned to: Julio Casal CPU Architecture:Any

[4 May 2009 22:47] Thiago Sayao
Description:
When the site runs for a couple of days (3-4) without restarting IIS, this error appears:

System.Configuration.ConfigurationErrorsException: Unable to initialize provider.  Missing or incorrect schema. (e:\home\sayao\web\web.config line 167)
   at System.Web.Security.Roles.Initialize()
   at System.Web.Security.RoleManagerModule.OnEnter(Object source, EventArgs eventArgs)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Simply resetting the application pool or changing web.config fixes it, until the next couple of days. I don't know if it changes anything, but i have the option to cache roles on cookies on.

Here is my config:

		<roleManager enabled="true" defaultProvider="MySQLRoleProvider" cacheRolesInCookie="true">
			<providers>
				<clear/>
				<add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.0.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="Connection" applicationName="DotNetBurner"/>
			</providers>
		</roleManager>

How to repeat:
Use the role provider.
Run a site for a couple of days.
[5 May 2009 10:02] Tonci Grgin
Hi Thiago and thanks for your report.

Unfortunately, it contains no info I could use to pin the problem down... "Use heavy site" is meaningless, or better, means different for everybody.

Can you please describe your problem better, especially the environment? From what I gather, this could very well happen due to some caching/timeout in IIS.
[5 May 2009 21:46] Thiago Sayao
I will try to explain it better:

The error says it's unable to initialize the provider and that the schema is either missing or incorrect. But this errors appears when the site runs for a few days (about 3 or 4 days). This means that the schema is correct and it is not missing. I can make this "assumption" because it works for some days and then suddenly stop working. Also, if i simply restart the application pool, without changing anything it works again. So, i think there is probably something work, specially because it works and then don't.

The environment is:
Windows 2008 Server Enterprise Edition
IIS 7 with integrated mode
Asp.net 3.5 SP1
The site runs on asp.net mvc

Thanks
[6 May 2009 14:45] Tonci Grgin
Thiago, I'd say you hit this or that limit in IIS as c/NET is not changing dynamically... "simply restart the application pool", AppPool is under IIS.
[6 May 2009 21:48] Thiago Sayao
If connector/Net supports IIS7 it should know if IIS changes anything and take care of it. 
Also, i have downgraded c/NET to 5.2.6 and it's running fine for 3 days. Anything changed? Maybe it's not checking that the role cookie can expire (just guessing here).
[7 May 2009 8:56] Tonci Grgin
> If connector/Net supports IIS7 it should know if IIS changes anything and take care of it.

No it should not. It is your task to configure FW and server for what you need.

> Also, i have downgraded c/NET to 5.2.6 and it's running fine for 3 days. Anything changed?

Of course it did. But you said new connector also works for 3-4 days. Any news? Old connector working for more than 4 days?

> Maybe it's not checking that the role cookie can expire (just guessing here).

Maybe, really can't tell. This is fishy and, due to Bug#44414, I can't even begin to test, even if I knew where to start... Will notify c/NET team of this.
[11 May 2009 9:49] Tonci Grgin
Thiago, so?
[11 Jun 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[26 Aug 2010 16:45] Nathan Taylor
I have just experienced this exact same problem on one of my websites using Connector/Net 6.1.2 and restarting the application corrected the problem. I have never seen this error before today.

System.Configuration.ConfigurationErrorsException: Unable to initialize provider.  Missing or incorrect schema. (C:\wwwroot\466092\www.citycakescafe.com\web\content\web.config line 110)
   at System.Web.Security.Roles.Initialize()
   at System.Web.Security.RoleManagerModule.OnEnter(Object source, EventArgs eventArgs)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
[11 May 2011 16:10] Julio Casal
I cannot reproduce this issue, but after reviewing the code I got to the conclusion that most of the time this is related to a connection string error. However the current code does not provide an appropriate exception message.

Given that, I have introduced a small patch to correctly throw an ArgumentException that will specify the connection string key that is wrong. Please use the new version and let me know if you keep getting the same "Missing or incorrect schema" message.

The patch is included in versions 6.0.8, 6.1.6, 6.2.5, 6.3.7 and 6.4.1