elmah - Error Logging Modules and Handlers for ASP.NET - 1 : 初体验
elmah(英文):https://code.google.com/p/elmah/
写作思路:先看结果,然后再说原理
elmah文章基本内容如下
1.安装
2.基本使用
3.详细配置讲解
简介
ELMAH是一个开源项目,其目的是记录和报告在ASP.NET Web应用程序未处理的异常。
早在2004年9月与Atif阿齐兹和斯科特·米切尔发表在MSDN Library,其目的是作为一个概念证明,编写自包含的功能与ASP.NET HTTP模块和处理程序是绝对有可能的,大多有这种特征可能是一篇文章插入没有重新编译和小的改动配置文件的现有应用程序。 为了展示这些概念的文章发表了示例项目,其目的是为了拦截,记录和通知ASP.NET应用程序中发生未处理的异常。 它被赋予ELMAH的名称,错误日志记录模块和处理程序。
1.安装
新建一个MVC项目,在nuget的控制台输入命令回车进行安装:Install-Package elmah
MVC项目详情如下
开发环境
vs 2012
sql server 2012
HomeController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc; namespace Jean.ElmahSample.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/ public ActionResult Index()
{
return View();
} }
}
Index View :
运行显示效果:
安装后 web.config 文件内容变为如下图-1-1所示(暂时先不要管里面的内容是什么意思,后面再慢慢解答)
图-1-1
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-Jean.ElmahSample-20140524091142;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-Jean.ElmahSample-20140524091142.mdf" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<elmah>
<!--
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
more information on remote access and securing ELMAH.
-->
<security allowRemoteAccess="false" />
</elmah>
<location path="elmah.axd" inheritInChildApplications="false">
<system.web>
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
</httpHandlers>
<!--
See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
more information on using ASP.NET authorization securing ELMAH. <authorization>
<allow roles="admin" />
<deny users="*" />
</authorization>
-->
</system.web>
<system.webServer>
<handlers>
<add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
</location>
</configuration>
2.基本使用
错误数据源(错误存储的地方)
2.1 存储在内存中
输入地址 http://localhost:5547/home/about
看下图结果
图2-1
输入地址 http://localhost:5547/elmah.axd (elmah.axd不是一个真实存在的文件,也不需要我们自己去新建)
看下图结果
图2-2
点击并试一试
RSS FEED
DOWNLOAD LOG
点击图2-2中Details 查看详情如下
默认情况下,错误存储在内存中,错误数量上限为15
修改web.config中elmah节点,并设置错误数量上限为5
(当第6个错误出现时,前面5个存在的错误有一个会被最新的错误记录替换)
<elmah>
<!--Storing errors in memory-->
<errorLog type="Elmah.MemoryErrorLog, Elmah" size="5" />
</elmah>
2.2 存储在xml中
修改web.config中elmah节点,如下图
<elmah>
<!--Storing errors in XML files-->
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logdata-path="~/App_Data" />
</elmah>
输入地址 http://localhost:5547/home/adjkf
看下图结果
2.3 存储在sql server中
2.3.1 修改web.config文件,关键信息如下
<elmah>
<!--Storing errors in SQL Server-->
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="Elmah.Sql" />
</elmah> <connectionStrings>
<!--Northwind为我测试的数据库名称-->
<add name="Elmah.Sql" connectionString="Data Source=.;Initial Catalog=Northwind;Trusted_Connection=True" />
</connectionStrings>
2.3.2 在数据库里执行一下下面sql脚本(我测试的数据库是Northwind)
执行后会创建一张表ELMAH_Error和3个存储过程
/* ELMAH - Error Logging Modules and Handlers for ASP.NET
Copyright (c) 2004-9 Atif Aziz. All rights reserved. Author(s): Atif Aziz, http://www.raboof.com
Phil Haacked, http://haacked.com Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */ -- ELMAH DDL script for Microsoft SQL Server 2000 or later. -- $Id: SQLServer.sql 677 2009-09-29 18:02:39Z azizatif $ DECLARE @DBCompatibilityLevel INT
DECLARE @DBCompatibilityLevelMajor INT
DECLARE @DBCompatibilityLevelMinor INT SELECT @DBCompatibilityLevel = cmptlevel
FROM master.dbo.sysdatabases
WHERE name = DB_NAME() IF @DBCompatibilityLevel <> 80
BEGIN SELECT @DBCompatibilityLevelMajor = @DBCompatibilityLevel / 10 ,
@DBCompatibilityLevelMinor = @DBCompatibilityLevel % 10 PRINT N'
===========================================================================
WARNING!
--------------------------------------------------------------------------- This script is designed for Microsoft SQL Server 2000 (8.0) but your
database is set up for compatibility with version '
+ CAST(@DBCompatibilityLevelMajor AS NVARCHAR(80)) + N'.'
+ CAST(@DBCompatibilityLevelMinor AS NVARCHAR(80)) + N'. Although
the script should work with later versions of Microsoft SQL Server,
you can ensure compatibility by executing the following statement: ALTER DATABASE [' + DB_NAME()
+ N']
SET COMPATIBILITY_LEVEL = 80 If you are hosting ELMAH in the same database as your application
database and do not wish to change the compatibility option then you
should create a separate database to host ELMAH where you can set the
compatibility level more freely. If you continue with the current setup, please report any compatibility
issues you encounter over at: http://code.google.com/p/elmah/issues/list ===========================================================================
'
END
GO /* ------------------------------------------------------------------------
TABLES
------------------------------------------------------------------------ */ CREATE TABLE [dbo].[ELMAH_Error]
(
[ErrorId] UNIQUEIDENTIFIER NOT NULL ,
[Application] NVARCHAR(60) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Host] NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Type] NVARCHAR(100) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Source] NVARCHAR(60) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[Message] NVARCHAR(500) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[User] NVARCHAR(50) COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL ,
[StatusCode] INT NOT NULL ,
[TimeUtc] DATETIME NOT NULL ,
[Sequence] INT IDENTITY(1, 1)
NOT NULL ,
[AllXml] NTEXT COLLATE SQL_Latin1_General_CP1_CI_AS
NOT NULL
)
ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[ELMAH_Error] WITH NOCHECK ADD
CONSTRAINT [PK_ELMAH_Error] PRIMARY KEY NONCLUSTERED ([ErrorId]) ON [PRIMARY]
GO ALTER TABLE [dbo].[ELMAH_Error] ADD
CONSTRAINT [DF_ELMAH_Error_ErrorId] DEFAULT (NEWID()) FOR [ErrorId]
GO CREATE NONCLUSTERED INDEX [IX_ELMAH_Error_App_Time_Seq] ON [dbo].[ELMAH_Error]
(
[Application] ASC,
[TimeUtc] DESC,
[Sequence] DESC
)
ON [PRIMARY]
GO /* ------------------------------------------------------------------------
STORED PROCEDURES
------------------------------------------------------------------------ */ SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO CREATE PROCEDURE [dbo].[ELMAH_GetErrorXml]
(
@Application NVARCHAR(60) ,
@ErrorId UNIQUEIDENTIFIER
)
AS
SET NOCOUNT ON SELECT [AllXml]
FROM [ELMAH_Error]
WHERE [ErrorId] = @ErrorId
AND [Application] = @Application GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO CREATE PROCEDURE [dbo].[ELMAH_GetErrorsXml]
(
@Application NVARCHAR(60) ,
@PageIndex INT = 0 ,
@PageSize INT = 15 ,
@TotalCount INT OUTPUT
)
AS
SET NOCOUNT ON DECLARE @FirstTimeUTC DATETIME
DECLARE @FirstSequence INT
DECLARE @StartRow INT
DECLARE @StartRowIndex INT SELECT @TotalCount = COUNT(1)
FROM [ELMAH_Error]
WHERE [Application] = @Application -- Get the ID of the first error for the requested page SET @StartRowIndex = @PageIndex * @PageSize + 1 IF @StartRowIndex <= @TotalCount
BEGIN SET ROWCOUNT @StartRowIndex SELECT @FirstTimeUTC = [TimeUtc] ,
@FirstSequence = [Sequence]
FROM [ELMAH_Error]
WHERE [Application] = @Application
ORDER BY [TimeUtc] DESC ,
[Sequence] DESC END
ELSE
BEGIN SET @PageSize = 0 END -- Now set the row count to the requested page size and get
-- all records below it for the pertaining application. SET ROWCOUNT @PageSize SELECT errorId = [ErrorId] ,
application = [Application] ,
host = [Host] ,
type = [Type] ,
source = [Source] ,
message = [Message] ,
[user] = [User] ,
statusCode = [StatusCode] ,
time = CONVERT(VARCHAR(50), [TimeUtc], 126) + 'Z'
FROM [ELMAH_Error] error
WHERE [Application] = @Application
AND [TimeUtc] <= @FirstTimeUTC
AND [Sequence] <= @FirstSequence
ORDER BY [TimeUtc] DESC ,
[Sequence] DESC
FOR XML AUTO GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO CREATE PROCEDURE [dbo].[ELMAH_LogError]
(
@ErrorId UNIQUEIDENTIFIER ,
@Application NVARCHAR(60) ,
@Host NVARCHAR(30) ,
@Type NVARCHAR(100) ,
@Source NVARCHAR(60) ,
@Message NVARCHAR(500) ,
@User NVARCHAR(50) ,
@AllXml NTEXT ,
@StatusCode INT ,
@TimeUtc DATETIME
)
AS
SET NOCOUNT ON INSERT INTO [ELMAH_Error]
( [ErrorId] ,
[Application] ,
[Host] ,
[Type] ,
[Source] ,
[Message] ,
[User] ,
[AllXml] ,
[StatusCode] ,
[TimeUtc]
)
VALUES ( @ErrorId ,
@Application ,
@Host ,
@Type ,
@Source ,
@Message ,
@User ,
@AllXml ,
@StatusCode ,
@TimeUtc
) GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
浏览器输入地址http://localhost:5547/abc123ds
在数据库输入脚本并查看结果如下
SQLite与Oracle的配置与sql server类似,就不重复了,
相关脚本下载地址:https://code.google.com/p/elmah/downloads/list
2.4 手动记录错误
方法:
ErrorSignal.FromCurrentContext().Raise()
现在我们创造2个错误并记录
修改HomeController如下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Elmah; namespace Jean.ElmahSample.Controllers
{
public class HomeController : Controller
{
//
// GET: /Home/ public ActionResult Index()
{
try
{
var t = int.Parse("abc");
}
catch (Exception e)
{
ErrorSignal.FromCurrentContext().Raise(e); // error 1
ErrorSignal.FromCurrentContext().Raise(new ArgumentNullException()); // error 2
}
return View();
} }
}
重新生成
浏览器输入 http://localhost:5547
新开窗口输入 http://localhost:5547/elmah.axd
结果如下
elmah - Error Logging Modules and Handlers for ASP.NET - 1 : 初体验的更多相关文章
- ASP.NET MVC 初体验
MVC系列文章终于开始了,前段时间公司项目结束后一直在封装一个html+ashx+js+easyui的权限系统,最近差不多也完成了,迟些时候会分享源码给大家.当然这个MVC系列结束后如果时间允许还会另 ...
- Demystifying ASP.NET MVC 5 Error Pages and Error Logging
出处:http://dusted.codes/demystifying-aspnet-mvc-5-error-pages-and-error-logging Error pages and error ...
- An error occurred: No action handlers found - check JMeterHome and libraries
An error occurred: No action handlers found - check JMeterHome and libraries Writing log file to: D: ...
- Oracle 11g使用DML Error Logging来避免bulk insert故障
当使用带有子查询的insert语句来加载数据时如果出现错误.系统会终止该语句并回滚整个操作.这是非常消耗时间和资源的操作.如果insert这样的语句可以使用DML Error Logging功能来避免 ...
- nginx 编译某个模板的问题./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library stati
root@hett-PowerEdge-T30:/usr/local/src/nginx-1.9.8# ./configure --prefix=/usr/local/nginx --add-mod ...
- ASP.NET2.0组件控件开发视频 初体验
原文:ASP.NET2.0组件控件开发视频 初体验 ASP.NET2.0组件控件开发视频 初体验 录了视频,质量不是很好,大家体验下.我会重新录制的 如果不清楚,可以看看http://v.youku. ...
- ASP.NET Core 3.0 上的gRPC服务模板初体验(多图)
早就听说ASP.NET Core 3.0中引入了gRPC的服务模板,正好趁着家里电脑刚做了新系统,然后装了VS2019的功夫来体验一把.同时记录体验的过程.如果你也想按照本文的步骤体验的话,那你得先安 ...
- ELMAH--Using HTTP Modules and Handlers to Create Pluggable ASP.NET Components 77 out of 90 rated th
MSDN===http://msdn.microsoft.com/en-us/library/aa479332.aspx PROJECT==https://code.google.com/p/elma ...
- HTTP Message Handlers in ASP.NET Web API
https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/http-message-handlers A message ha ...
随机推荐
- Flex中如何通过设置GridLines对象的horizontalAlternateFill样式交错显示LineSeries图表背景颜色的例子
原文 http://blog.minidx.com/2008/11/27/1652.html 接下来的例子演示了Flex中如何通过设置GridLines对象的horizontalAlternateFi ...
- Hibernate 、多表关联映射-组件关联映射(component)
组件关联映射可以将一些简小的数据与主题放在一个表中,例如firstName 和LastName这两个结合在一起可以组成一个名字,但是再分别将这两个再建一个表就不太合适了,这个时候可以用到组件关联映射: ...
- javascript数组去重算法-----3
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- http multipart/form-data POST文件上传详解
POST /test/index.php HTTP/1.1 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:26.0) Gecko/20100101 Firef ...
- 你必须知道的 34 个简单实用的 Ubuntu 快捷键
ubuntu常用的快捷键: 1. Ctrl + W: 关闭当前 Nautilus 窗口 2. Ctrl+T: 在 Nautilus 打开新的 Tab 3. Ctrl + H: 切换隐藏文件(夹)显 ...
- linux内核源码阅读之facebook硬盘加速flashcache之六
其实到目前为止,如果对读流程已经能轻松地看懂了,那么写流程不需要太多脑细胞.我觉得再写下去没有太大的必要了,后面想想为了保持flashcache完整性,还是写出来吧.接着到写流程: 1530stati ...
- android入门——Service
简单记录一下四大组件之一的Service的简单实用. 先是最简单的用法,服务的开关,onBind方法的使用 package com.example.wkp.service; import androi ...
- J2EE在Web容器中启动报错:com.sun.jdi.InvocationException occurred invoking method.
我只是将Hibernate映射文件中的lazy属性有true改为lazy="false",即解决了上述问题.当然我之前也遇到一个问题是不调试时插入数据是不成功的,但是在Debug模 ...
- C++ Primer 读书笔记: 第8章 标准IO库
第8章 标准IO库 8.1 面向对象的标准库 1. IO类型在三个独立的头文件中定义:iostream定义读写控制窗口的类型,fstream定义读写已命名文件的类型,而sstream所定义的类型则用于 ...
- BZOJ 3221: [Codechef FEB13] Obserbing the tree树上询问( 可持久化线段树 + 树链剖分 )
树链剖分+可持久化线段树....这个一眼可以看出来, 因为可持久化所以写了标记永久化(否则就是区间修改的线段树的持久化..不会), 结果就写挂了, T得飞起...和管理员拿数据调后才发现= = 做法: ...