예제 #1
0
 public object BeforeCall(string operationName, object[] inputs)
 {
     var cinfo = new LogInfo();
     cinfo.Action = operationName;
     cinfo.StartTimeStamp = DateTime.Now;
     cinfo.ServiceName = OperationContext.Current.InstanceContext.GetServiceInstance().GetType().Name;
     return cinfo;
 }
        public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext)
        {
            LogInfo cinfo = new LogInfo();

            //Collect any info that passed in the headers from Client, if any.

            cinfo.ServerTimeStamp = DateTime.Now; //Timestamp after the call is received.
            cinfo.Platform = "WCF";
            OperationDescription operationDesc = GetOperationDescription(OperationContext.Current);
            if (operationDesc != null)
            {
                Type contractType = operationDesc.DeclaringContract.ContractType;
                cinfo.Action = operationDesc.Name;
                cinfo.ServiceName = contractType.FullName;
                cinfo.AssemblyName = contractType.Assembly.GetName().Name;
            }

            cinfo.ServerName = Dns.GetHostName();
            cinfo.ServerProcessName = System.AppDomain.CurrentDomain.FriendlyName;

            return cinfo;
        }