An ActiveRecord class (XXXXXXXXX) was used but the framework seems not properly initialized. Did you
2017-05-08 15:48
696 查看
问题:
An ActiveRecord class (XXXXXXXXX) was used but the framework seems not properly initialized. Did you forget about ActiveRecordStarter.Initialize() ?
解决方案:在Global.asax.cs中加入以下代码,如:
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
// 在应用程序启动时运行的代码
IConfigurationSource source = ActiveRecordSectionHandler.Instance;
ActiveRecordStarter.Initialize(System.Reflection.Assembly.Load("你自己XX"), source);
}
protected void Session_Start(object sender, EventArgs e)
{
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
HttpContext.Current.Items.Add("ar.sessionscope", new SessionScope(FlushAction.Never));
}
protected void Application_EndRequest(object sender, EventArgs e)
{
try
{
SessionScope scope = HttpContext.Current.Items["ar.sessionscope"] as SessionScope;
if (scope != null)
{
scope.Dispose();
}
}
catch (Exception ex)
{
HttpContext.Current.Trace.Warn("Error", "EndRequest: " + ex.Message, ex);
}
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
{
}
protected void Application_Error(object sender, EventArgs e)
{
}
protected void Session_End(object sender, EventArgs e)
{
}
protected void Application_End(object sender, EventArgs e)
{
}
}
相关文章推荐
- A new session could not be created. (Original error: Requested a new session but one was in progress) (WARNING: The server did not provide any stacktrace information)
- The LogManager was not properly installed (you must set the "java.util.logging.manager" system prop
- emulator: ERROR: You did not provide the name of an Android Virtual Device
- Jboss:The LogManager was not properly installed (you must set the "java.util.logging.manager" system prop
- Compiler Error Message: CS0234: The type or namespace name 'BorderDetails' does not exist in the class or namespace 'Infragistics.WebUI.Shared' (are you missing an assembly reference?)
- org.springframework.security.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityC
- org.hibernate.QueryException: query specified join fetching, but the owner of the fetched association was not present in the sel
- org.springframework.beans.factory.BeanCreationException: Scope 'request' is not active for the current thread
- AS.NET2.0 用户控件错误!!The base class includes the field 'MyControl_1', but its type (MyControl) is not compatible with the type of control (ASP.MyControl_ascx).
- The Seg Square was not closed, but closing. However, I've bought what I want.
- 如何解决The type or namespace name 'ScriptService' could not be found (are you missing a using directive or an assembly reference?)
- The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one
- Why is the size of an empty class not zero?
- iPhone 自检工程错误解决方法:loaded the "MyView" nib but the view outlet was not set
- The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build pat
- How to cal Session_End() method when you store the Session state not in Inprc but StageServer, etc.
- Eclipse:Could not create the view: Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.jdt.internal.ui.packageview.P
- Deserialization Problems ... The constructor to deserialize an object of type ... was not found
- The base class includes the field '...', but its type (...) is not compatible with the type of control (...)
- .Net Remoting 排错笔记:The constructor to deserialize an object of type 'xxx.xxxx.xxxxx' was not found.