Наследование: System.Data.Objects.DataClasses.EntityObject
Пример #1
0
        /// <summary>
        /// Create a new iis_failed_request object.
        /// </summary>
        /// <param name="id">Initial value of the ID property.</param>
        /// <param name="url">Initial value of the url property.</param>
        /// <param name="duration">Initial value of the duration property.</param>
        /// <param name="created">Initial value of the created property.</param>
        /// <param name="computer">Initial value of the computer property.</param>
        /// <param name="status">Initial value of the status property.</param>
        public static iis_failed_request Createiis_failed_request(global::System.Int32 id, global::System.String url, global::System.Int32 duration, global::System.DateTime created, global::System.String computer, global::System.String status)
        {
            iis_failed_request iis_failed_request = new iis_failed_request();

            iis_failed_request.ID       = id;
            iis_failed_request.url      = url;
            iis_failed_request.duration = duration;
            iis_failed_request.created  = created;
            iis_failed_request.computer = computer;
            iis_failed_request.status   = status;
            return(iis_failed_request);
        }
Пример #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the iis_failed_request EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToiis_failed_request(iis_failed_request iis_failed_request)
 {
     base.AddObject("iis_failed_request", iis_failed_request);
 }
Пример #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the iis_failed_request EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToiis_failed_request(iis_failed_request iis_failed_request)
 {
     base.AddObject("iis_failed_request", iis_failed_request);
 }
Пример #4
0
        public static void TransferToSqlAzure()
        {
            GenUtils.LogMsg("info", "IIS_FailedRequestLogs.TransferToSqlAzure", null);
            var bs = BlobStorage.MakeDefaultBlobStorage();
            var containername = "wad-iis-failedreqlogfiles";
            var failed_req_dicts = (List<Dictionary<string, string>>)bs.ListBlobs(containername).response;
            failed_req_dicts = failed_req_dicts.FindAll(blob => (blob["Name"].EndsWith("xsl") == false));
            var failed_req_blobs = failed_req_dicts.Select(blob => blob["Name"]);

            var model_name = "iis_failed_request";
            var conn_str = GenUtils.MakeEntityConnectionString(model_name);
            var entities = new iis_failed_request_entities(conn_str);

            foreach (var blobname in failed_req_blobs)
            {
                var iis_failed_request = new iis_failed_request();
                XDocument xdoc;
                XElement failed_request;
                try
                {
                    var response = bs.GetBlob(containername, blobname).HttpResponse;
                    xdoc = XmlUtils.XdocFromXmlBytes(response.bytes);
                    failed_request = xdoc.Root;
                    XNamespace evt_ns = "http://schemas.microsoft.com/win/2004/08/events/event";
                    var system = failed_request.Descendants(evt_ns + "System").First();
                    var time_created_str = system.Element(evt_ns + "TimeCreated").Attribute("SystemTime").Value;

                    iis_failed_request.computer = system.Element(evt_ns + "Computer").Value;
                    iis_failed_request.created = DateTime.Parse(time_created_str);
                    iis_failed_request.reason = failed_request.Attribute("failureReason").Value;
                    iis_failed_request.duration = Convert.ToInt32(failed_request.Attribute("timeTaken").Value);
                    iis_failed_request.status = failed_request.Attribute("statusCode").Value;
                    iis_failed_request.url = failed_request.Attribute("url").Value;
                }
                catch (Exception ex_xml)
                {
                    GenUtils.PriorityLogMsg("exception", "IIS_FailedRequestLogs.TransferToSqlAzure Unpack XML", ex_xml.Message + ex_xml.InnerException.Message + ex_xml.StackTrace);
                }

                try
                {
                    entities.AddObject(entitySetName: model_name, entity: iis_failed_request);
                    var db_result = entities.SaveChanges();

                    if (db_result != 1)
                        GenUtils.PriorityLogMsg("warning", "IIS_FailedRequestLogs.TransferToSqlAzure expected 1 saved change but got " + db_result.ToString(), null);
                }
                catch (Exception ex_db)
                {
                    GenUtils.PriorityLogMsg("exception", "IIS_FailedRequestLogs.TransferToSqlAzure SaveChanges", ex_db.Message + ex_db.InnerException.Message + ex_db.StackTrace);
                }

                try
                {

                    var bs_result = bs.DeleteBlob(containername, blobname);
                    var status = bs_result.HttpResponse.status;
                    if (status != System.Net.HttpStatusCode.Accepted)
                        GenUtils.LogMsg("warning", "IIS_FailedRequestLogs.TransferToSqlAzure expected Accepted but got " + status.ToString(), null);
                }
                catch (Exception bs_db)
                {
                    GenUtils.PriorityLogMsg("exception", "IIS_FailedRequestLogs.TransferToSqlAzure DeleteBlob", bs_db.Message + bs_db.StackTrace);
                }

            }
        }
Пример #5
0
 /// <summary>
 /// Create a new iis_failed_request object.
 /// </summary>
 /// <param name="id">Initial value of the ID property.</param>
 /// <param name="url">Initial value of the url property.</param>
 /// <param name="duration">Initial value of the duration property.</param>
 /// <param name="created">Initial value of the created property.</param>
 /// <param name="computer">Initial value of the computer property.</param>
 /// <param name="status">Initial value of the status property.</param>
 public static iis_failed_request Createiis_failed_request(global::System.Int32 id, global::System.String url, global::System.Int32 duration, global::System.DateTime created, global::System.String computer, global::System.String status)
 {
     iis_failed_request iis_failed_request = new iis_failed_request();
     iis_failed_request.ID = id;
     iis_failed_request.url = url;
     iis_failed_request.duration = duration;
     iis_failed_request.created = created;
     iis_failed_request.computer = computer;
     iis_failed_request.status = status;
     return iis_failed_request;
 }