Recently, I made an outsourcing project for the old American, and I was forced to have a method about the wrong handling. I didn't dare to hide it, and I won it to everyone. First, all automatic error handles in the shield process do not come out: "System.Web.Services.protocols.soapexception: system.Web.Services.protocols.soapexception: The server cannot process the request." Waiting for the error page, but should be Some simple and easy-to-understand things are here to use the error handling page in Duwamish 7.0:
We were unable to completion your request. This failure Has Been logged with our system administrators, who are currently working to resolve the problem. We apologize for any inconvenience caused by this temporary service outage, and we appreciate your patience as we work to improve our web site. P> body> course It is also very simple to do this, you can configure this in web.config (if your error page is Error.ASPX):
We define the structure of the error log information as follows PUBLIC STRUCT ERRORLOGITEM {public string user; // Current login public string appname; // application name public string classname; // Error class name public string functionName; // error occurred Method (Event) Name Public String Position; / / Error Position (or Other Information) Public String ErrorInfo; // Error Message Public DateTime Occurtime; / / Error Time} Error Log As shown: public class errorlog {private static ErrorLog _Instance = null; private static string strRootName; private static XmlElement xmlRoot; private static XmlDocument xmlDoc; private ErrorLog () {Load ();} private bool Load () {if CreateErrorLogFile (File.Exists (AppGlobal.ErrorLogFile)!) (AppGlobal.errorLogfile); if (xmldoc == null) xmldoc = new xmldocument (); try { xmlDoc.Load (AppGlobal.ErrorLogFile);} catch {return false;} xmlRoot = xmlDoc.DocumentElement; if (! xmlRoot = null) strRootName = "/" xmlRoot.Name "/"; return true;} private void CreateErrorLogFile (string strfilename) {StringBuilder SB = new stringbuilder (); sb.append ("
sb.Append ( " errorlog>"); XmlDocument xmlDoc = new XmlDocument (); xmlDoc.LoadXml (sb.ToString ()); xmlDoc.Save (strFileName);} private void AddXmlAttribute (XmlElement xNode, string strAttr, string strAttrvalue) {XmlAttribute xAttr = (XmlAttribute) xmlDoc.CreateNode (XmlNodeType.Attribute, strAttr, null); xAttr.InnerText = strAttrvalue; xNode.Attributes.Append (xAttr);} public void SetErrorLog (ErrorLogItem errItem) {XmlElement xErrorElement = xmlDoc .CreateElement ( "error"); AddXmlAttribute (xErrorElement, "username", errItem.User); AddXmlAttribute (xErrorElement, "application", errItem.AppName); AddXmlAttribute (xErrorElement, "classname", errItem.ClassName); AddXmlAttribute (xErrorElement , "functionname", erritem.functionname); AddXMLAT tribute (xErrorElement, "position", errItem.Position); AddXmlAttribute (xErrorElement, "occurtime", errItem.OccurTime.ToString ( "g")); xErrorElement.InnerText = errItem.ErrorInfo; xmlRoot.AppendChild (xErrorElement); if ( xmlRoot.ChildNodes.Count> AppGlobal.MaxErrorLogCount) xmlRoot.RemoveChild (xmlRoot.FirstChild); xmlDoc.Save (AppGlobal.ErrorLogFile);} public static ErrorLog Instance () {if (_Instance ==
NULL) {_instance = new errorlog ();} return _instance;}} // end class We can write the information to the log by calling the setErrorLog method.
Of course, the location of the log and the number of logging error messages are also the Erritem.Appname " div>"; strmailbody = " Of course, also can be configured e-mail address: