新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> DTD, XML Schema(XMLS), RELAX NG
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 DTD/XML Schema 』 → can't log, please jim Answer 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 5038 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: can't log, please jim Answer 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     f1029303 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:35
      积分:262
      门派:XML.ORG.CN
      注册:2007/9/7

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给f1029303发送一个短消息 把f1029303加入好友 查看f1029303的个人资料 搜索f1029303在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看f1029303的博客楼主
    发贴心情 can't log, please jim Answer

    Appcode/httphandler.cs

    using System;
    using System.IO;
    using System.Text;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using AppTalk.Util.Compression;
    using AppTalk.Util.Configuration;
    using AppTalk.Util.Log;
    using AppTalk.Util.Delivery;
    using AppTalk.Util.Messaging;


    /// <summary>
    /// Summary description for HttpHandler
    /// </summary>
    ///
    namespace AppTalk.Process.Http
    {   

        public class HttpHandler : IHttpHandler
        {   
            private const string File_Name = @"../data/outbound/";       // for saving the raw data
            private const string CfgFile = @"../config/processSvc.cfg";  // for config file
            private string ReqStr = null;
            private string vStatusMsg = null;
           
            public void ProcessRequest(HttpContext ctx)
            {
                Logger.LogInfo("a new request start ...");
                try
                {
                    Stream RcvStream = ctx.Request.InputStream;
                    string ReqUrl = ctx.Request.Url.ToString();
                    Logger.LogInfo("Url:" + ReqUrl);

                    string CharSet = ctx.Request.Headers.Get("CharSet");
                    Encoding Encode = System.Text.Encoding.GetEncoding(CharSet);
                    StreamReader ReadStrm = new StreamReader(RcvStream, Encode);
                    ReqStr = ReadStrm.ReadToEnd();
                    byte[] RawData = System.Text.Encoding.UTF8.GetBytes(ReqStr);

                    // if need GUnzip then ...
                    string GzipFlg = ctx.Request.Headers.Get("Encoding");
                    if (GzipFlg == "G-ZIP")
                    {
                        RawData = GzipCompress.GUnZip(RawData);
                        Logger.LogInfo("Unzip successfully");
                    }

                    //get the config handle Type ( save to file  or  call application function)                     
                    string MsgCatg = ctx.Request.Headers.Get("MsgCatg");
                    string DocType = ctx.Request.Headers.Get("DocType");
                    string DocID = ctx.Request.Headers.Get("DocID");
                    string FileName = ctx.Request.Headers.Get("FileName");

                    //get current folder
                    string strCurrentPath = AppDomain.CurrentDomain.BaseDirectory + FileName;

                    Logger.LogInfo("MsgCatg:" + MsgCatg + " " + "DocType:" + DocType + " " + "DocID:" + DocID + "" + "FileName:" + FileName);

                    AppTalkMessage ATMsg = new AppTalkMessage();
                    ATMsg.MsgCatg = MsgCatg;
                    ATMsg.DocType = DocType;
                    ATMsg.DocID = DocID;
                    ATMsg.Encoding = GzipFlg;
                    ATMsg.Charset = CharSet;
                    ATMsg.FileName = strCurrentPath;
                    ATMsg.Content = RawData;               

                    MessageChannel MsgSender = new MessageChannel();
                    string SendStatus = MsgSender.Send(ATMsg, out vStatusMsg);

                }
                catch (Exception ex)
                {
                    Logger.LogInfo("Handle failed" + ex.ToString());
                }
            }


            public bool IsReusable
            {
                get
                {
                    return true;
                }
            }


            public HttpHandler()
            {
                //
                // TODO: Add constructor logic here
                //
            }
        }
    }

    [此贴子已经被作者于2007-10-26 20:32:29编辑过]

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/10/25 19:57:00
     
     f1029303 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:35
      积分:262
      门派:XML.ORG.CN
      注册:2007/9/7

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给f1029303发送一个短消息 把f1029303加入好友 查看f1029303的个人资料 搜索f1029303在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看f1029303的博客2
    发贴心情 
    // global.asax
    // log4net.Config.XmlConfigurator.Configure();    Useful   ?????

    <%@ Application Language="C#" %>

    <script runat="server">

        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            log4net.Config.XmlConfigurator.Configure();  // 2007-09-01

        }
        
        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

        }
            
        void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs

        }

        void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started

        }

        void Session_End(object sender, EventArgs e)
        {
            // Code that runs when a session ends.
            // Note: The Session_End event is raised only when the sessionstate mode
            // is set to InProc in the Web.config file. If session mode is set to StateServer
            // or SQLServer, the event is not raised.

        }
           
    </script>

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/10/26 20:35:00
     
     f1029303 帅哥哟,离线,有人找我吗?
      
      
      等级:大二(研究C++)
      文章:35
      积分:262
      门派:XML.ORG.CN
      注册:2007/9/7

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给f1029303发送一个短消息 把f1029303加入好友 查看f1029303的个人资料 搜索f1029303在『 DTD/XML Schema 』的所有贴子 引用回复这个贴子 回复这个贴子 查看f1029303的博客3
    发贴心情 
    // default.aspx.cs
    // Logger.LogInfo(AppDomain.CurrentDomain.BaseDirectory+"test information");  can't log

    //step 1
    //C:\Inetpub\wwwroot\AppTalk\AppTalk.Http
    //C:\Inetpub\wwwroot\AppTalk\AppTalk.Http\config  Log4net.cnf
    //C:\Inetpub\wwwroot\AppTalk\AppTalk.Http\logs
        
    // step 2
    //C:\Inetpub\wwwroot\AppTalk\AppTalk.Http
    //C:\Inetpub\wwwroot\AppTalk\config  Log4net.cnf
    //C:\Inetpub\wwwroot\AppTalk\logs    

    //Choose step 1 or  step 2


    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using AppTalk.Util.Log;
    using System.Collections;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            Logger.LogInfo(AppDomain.CurrentDomain.BaseDirectory+"test information");
            
            DateTime dt = DateTime.Now;
            Response.Write(dt+"</br>");
            Response.Write(AppDomain.CurrentDomain.BaseDirectory);
        }
    }

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/10/26 20:40:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 DTD/XML Schema 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/11/22 14:26:25

    本主题贴数3,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    85.938ms