Getting strange exception while loggin into sitefiniy backend
Hi I am getting this strange exception while logging in to sitefinity backend on production server.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Type is enhanced and registered, but not available from the database class meta data. This can be caused by a wrong connection id or configuration.
Parameter name: type
Actual value was Telerik.Sitefinity.Licensing.Model.UserActivity.
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.ArgumentOutOfRangeException: Type is enhanced and registered, but not available from the database class meta data. This can be caused by a wrong connection id or configuration.
Parameter name: type
Actual value was Telerik.Sitefinity.Licensing.Model.UserActivity.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentOutOfRangeException: Type is enhanced and registered, but not available from the database class meta data. This can be caused by a wrong connection id or configuration.
Parameter name: type
Actual value was Telerik.Sitefinity.Licensing.Model.UserActivity.]
DynamicModule.ns.Wrapped_OpenAccessUserActivityProvider_e3a0a89e50944e2486f73288c1c320a1.GetUserActivity(Guid userId, String providerName) +259
Telerik.Sitefinity.Security.SecurityManager.VerifyLoginRequest(User user, String loginIp, DateTime issueDate, List`1& allowedAccessSiteIDs, String tokenId, Boolean isToDisableUsersLoginsLimitation) +1257
Telerik.Sitefinity.Security.SecurityManager.Login(User user, UserManager manager, Boolean persistent, Boolean isBackend, DateTime issueDate, String tokenId, Boolean isToDisableUsersLoginsLimitation) +173
Telerik.Sitefinity.Security.SecurityManager.Login(ClaimsPrincipalProxy claimsPrincipal, String tokenId, DateTime issueDate) +302
Telerik.Sitefinity.Security.Claims.SitefinityClaimsAuthenticationModule.AuthenticateRequest(HttpContextBase context, String rawToken, String tokenType, String[] removeParams) +587
Telerik.Sitefinity.Security.Claims.SitefinityClaimsAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs args) +510
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
--------------------------------------------------------------------------------
Hi Majid,
Can you please restart the application and then test the behavior again. It is expected that a recycle would resolve the problem, because the model would re-initialize and the proper meta data will be registered.
One of the possible reasons for this type of error might be connected to the different connection strings that are accessing the same database. Can you please check if you have more than one connection strings which are pointing to one and the same database?
There are a couple of other clients who have reported similar problem on their end. Unfortunately the error does not give us detailed information what might cause this issue. This is why the best way for us to be able to troubleshoot this is to provide the following code, which will log some additional information, about the contents of the context at the time of the error occurring. Place the code in the Application_Error() method of the Global.asax:
protected
void
Application_Error(
object
sender, EventArgs e)
var err = ((HttpApplication)sender).Server.GetLastError();
if
((err
is
ArgumentOutOfRangeException) && err.Message.StartsWith(
"Type is enhanced and registered"
))
var strBuilder =
new
StringBuilder();
strBuilder.AppendFormat(
"Details regarding '0'"
, err.Message);
strBuilder.AppendLine();
var connectionsField = (
typeof
(OpenAccessConnection)).GetFields(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).FirstOrDefault(f => f.Name ==
"connections"
);
if
(connectionsField !=
null
)
var connections = connectionsField.GetValue(
null
)
as
IDictionary<
string
, OpenAccessConnection>;
foreach
(var connection
in
connections.Values)
strBuilder.AppendFormat(
"Connection: 0 / 1"
, connection.Name, connection.ConnectionString);
strBuilder.AppendLine();
var databaseField = (
typeof
(OpenAccessConnection)).GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).FirstOrDefault(f => f.Name ==
"currentDatabase"
);
if
(databaseField !=
null
)
var database = databaseField.GetValue(connection)
as
Database;
strBuilder.AppendFormat(
"Registered meta types: 0"
,
string
.Join(
"; "
, database.MetaData.PersistentTypes.Select(t => t.FullName)));
strBuilder.AppendLine();
var field = (
typeof
(OpenAccessConnection)).GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).FirstOrDefault(f => f.Name ==
"registeredModules"
);
if
(field !=
null
)
strBuilder.AppendFormat(
"Registered modules: 0"
,
string
.Join(
"; "
, ((HashSet<
string
>)field.GetValue(connection)).ToArray()));
strBuilder.AppendLine();
strBuilder.AppendLine(
"------------"
);
Log.Write(strBuilder.ToString(), System.Diagnostics.TraceEventType.Information);
Hi Sabrie,
Thanks for the reply.
Yes restarting the application actually works, but it only lasts for some time and problem starts kicking in again after some time. and i am sure i am using only once connection string in website. I do have other connection strings but they are separate databases.
I will add the code to App_Start and will share the logs with you.
In mean time let me tell you about the environment where this application is hosted, Actually we have two servers one is content publishing server and one production server. on content publishing server everything works fine. but on production server i get this error.
Thanks
Hello Majid,
Please make sure that you place the code in the Application_Error() method in the Global.asax file.
In addition to this, since the issue reproduces only in the production environment, it seems that the issue might be related to some environment settings. I hope that the errors logged in the Trace.log file will provide us more details about what is causing the issue.
Can you please let me know if the Sitefinity instances are connected to one database? Are you in a load balancing environment?
Regards,
Sabrie Nedzhip
Telerik
Sitefinity instances are connected to different databases. Actually we have two production servers, they have separate databases and on top of them sits the load balancer.
Re-cycling the application pool solves the problem, but i can't re-cycle the pool frequently as its production environment and why do i want to login to backend of production servers is because i am using some controls on the CPS that actually fetch form data from both production servers, combine and show on a backend page. I am using formservice to fetch data.
Hello Majid,
The load balancing configuration in general is used in cases when you have more than one Sitefinity instances which are connected to one single database. The load balancing feature establishes communication between the load-balanced servers so that Sitefinity to be able to send the cache invalidation requests to the servers when the content has been changed on one of the nodes and to ensure content consistency on all nodes.
In your case you have mentioned that you have two nodes which are pointing to different databases. Can you please verify this? Can you please also let me know how do you ensure the content consistency between the nodes so that the users see the same content on all nodes?
You may also refer to the following documentation article for more details about the load balancing feature and how it is configured in Sitefinity.
As for the error message, please send me the Trace.log file when it reproduces again in order to inspect the errors and to check what is causing it.
Regards,
Sabrie Nedzhip
Telerik
We're also experiencing the very same problem on Windows 2012, IIS 8. Recycling the application pool also solves the problem, but that is not a viable solution for a production website.
Has anyone been able to discern/identify the source of the problem, or at the very least, find a permanent solution?
We've already opened a support ticket with Telerik and they have not been able to offer any recommendations or suggestions to correct this. From what I've read so far, it appears to be related specifically to OpenAccess and caching of connection strings. We're running a single server in a DMZ as in most cases; nothing too fancy, with standard Sitefinity requirements met for roles/features.
We've even added a local DNS entry into the server's local HOSTS file, but the problem, while sporadic, continues to persist.
Hi,
We are aware of the existence of such an issue, however the issue occurs randomly and gets resolved after restarting the site.
We have performed multiple attempts to replicate the issue at our end by testing steps provided by clients and also testing on the client projects ran at our end to no avail. The issue replicates randomly and there are no concrete steps that lead to it.
The issue is also not connected to a specific module or functionality, currently in the error is occurring for ContentLocationDataItem, but this may be changed if the issue ever replicates again.
One scenario where this problem was replicated was fixed, here is the bug for this problem and a fix is provided in internal build 8.0.5717. The fix for this issue is available in Sitefintiy 8.1 so this is not the specific case you are encountering.
For now we don`t have a solution for this case, we recommend to restart the application to resolve the problem. We have gathered all support tickets that report this problem and once we find a solution an update will be provided to all.
The summary of the problem is that the error message
Type is enhanced and registered, but not available from the database class meta data
Details regarding Type is enhanced and registered, but not available from the database class meta data
Hi - We are experiencing the same error, however on the front-end with news and events details. As a result, we have a huge exposure with 500 errors with frequently reported errors from users and site admins for the multitude of sites on our multi-site platform.
Our developers have been in touch with Telerik however they have not been able to solve it. This must be a high-priority issue to be resolved.
mp/m
Hi,
The issue still comes up randomly tough an updated workaround is available in this KB article. When the error comes up it is captured in Application_Error and then the Db model is reset and the user gets redirected back to the page that threw the error:
OpenAccessConnection.ResetModel(reason,
true
);
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri);
We too are encountering this issue. We just enabled pushing users to Sitefinity / DEC and am taking this error on one server out of our 4 server farm. These servers are load-balanced, NOT Sitefinity load balancing but w/ a physical load balancer between servers and firewall.