public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity, Guid iid, int instanceID, bool traceContextTransaction)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallSchema schema = null;
         Guid empty = Guid.Empty;
         if (traceContextTransaction)
         {
             IComThreadingInfo info2 = (IComThreadingInfo) SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
             if (info2 != null)
             {
                 IObjectContextInfo info3 = info2 as IObjectContextInfo;
                 if ((info3 != null) && info3.IsInTransaction())
                 {
                     info3.GetTransactionId(out empty);
                 }
             }
             if (empty != Guid.Empty)
             {
                 schema = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, empty);
             }
         }
         else
         {
             schema = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
         }
         if (schema != null)
         {
             TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
         }
     }
 }
 public ComPlusTypeLoader(ServiceInfo info)
 {
     this.info = info;
     this.transactionFlow = (info.TransactionOption == TransactionOption.Required) || (info.TransactionOption == TransactionOption.Supported);
     this.interfaceResolver = new TypeCacheManager();
     this.contracts = new Dictionary<Guid, ContractDescription>();
 }
        public ComPlusInstanceContextInitializer(ServiceInfo info)
        {
            this.info = info;

            if (this.info.HasUdts())
            {
                string tempPath = String.Empty;
                lock (manifestLock)
                {

                    try
                    {
                        tempPath = Path.GetTempPath();
                    }
                    catch (Exception e)
                    {
                        if (Fx.IsFatal(e))
                            throw;

                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(System.ServiceModel.ComIntegration.Error.CannotAccessDirectory(tempPath));
                    }

                    string manifestDirectory = tempPath + this.info.AppID.ToString();
                    if (Directory.Exists(manifestDirectory))
                        Directory.Delete(manifestDirectory, true);
                }

            }
        }
 public ComPlusInstanceContextInitializer(ServiceInfo info)
 {
     this.info = info;
     if (this.info.HasUdts())
     {
         string directory = string.Empty;
         lock (manifestLock)
         {
             try
             {
                 directory = Path.GetTempPath();
             }
             catch (Exception exception)
             {
                 if (Fx.IsFatal(exception))
                 {
                     throw;
                 }
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.CannotAccessDirectory(directory));
             }
             string path = directory + this.info.AppID.ToString();
             if (Directory.Exists(path))
             {
                 Directory.Delete(path, true);
             }
         }
     }
 }
 public ComPlusThreadInitializer(ContractDescription contract, DispatchOperation operation, ServiceInfo info)
 {
     this.info = info;
     this.iid = contract.ContractType.GUID;
     if (info.CheckRoles)
     {
         string[] serviceRoleMembers = null;
         string[] contractRoleMembers = null;
         string[] operationRoleMembers = null;
         serviceRoleMembers = info.ComponentRoleMembers;
         foreach (ContractInfo info2 in this.info.Contracts)
         {
             if (!(info2.IID == this.iid))
             {
                 continue;
             }
             contractRoleMembers = info2.InterfaceRoleMembers;
             foreach (System.ServiceModel.ComIntegration.OperationInfo info3 in info2.Operations)
             {
                 if (info3.Name == operation.Name)
                 {
                     operationRoleMembers = info3.MethodRoleMembers;
                     break;
                 }
             }
             if (operationRoleMembers == null)
             {
                 throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ListenerInitFailed(System.ServiceModel.SR.GetString("ComOperationNotFound", new object[] { contract.Name, operation.Name })));
             }
             break;
         }
         this.comAuth = new ComPlusAuthorization(serviceRoleMembers, contractRoleMembers, operationRoleMembers);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusServiceHostSchema record = new ComPlusServiceHostSchema(info.AppID, info.Clsid);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity, Guid iid, int instanceID, Guid incomingTransactionID, Guid currentTransactionID)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallTxMismatchSchema schema = new ComPlusMethodCallTxMismatchSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, incomingTransactionID, currentTransactionID);
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ContractDescription contract)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         XmlQualifiedName contractQname = new XmlQualifiedName(contract.Name, contract.Namespace);
         ComPlusServiceHostCreatedServiceContractSchema schema = new ComPlusServiceHostCreatedServiceContractSchema(info.AppID, info.Clsid, contractQname, contract.ContractType.ToString());
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceEndpointCollection endpointCollection)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         foreach (ServiceEndpoint endpoint in endpointCollection)
         {
             ComPlusServiceHostCreatedServiceEndpointSchema schema = new ComPlusServiceHostCreatedServiceEndpointSchema(info.AppID, info.Clsid, endpoint.Contract.Name, endpoint.Address.Uri, endpoint.Binding.Name);
             TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
         }
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, System.ServiceModel.Description.ServiceDescription service)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         WsdlExporter exporter = new WsdlExporter();
         string ns = "http://tempuri.org/";
         XmlQualifiedName wsdlServiceQName = new XmlQualifiedName("comPlusService", ns);
         exporter.ExportEndpoints(service.Endpoints, wsdlServiceQName);
         System.Web.Services.Description.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[ns];
         ComPlusServiceHostStartedServiceDetailsSchema schema = new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord) schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceDescription service)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         WsdlExporter exporter = new WsdlExporter();
         string serviceNs = NamingHelper.DefaultNamespace;
         XmlQualifiedName serviceQName = new XmlQualifiedName("comPlusService", serviceNs);
         exporter.ExportEndpoints(service.Endpoints, serviceQName);
         WsdlNS.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[serviceNs];
         ComPlusServiceHostStartedServiceDetailsSchema record =
             new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
     }
 }
        protected void Initialize (Guid clsid,
                                   ServiceElement service,
                                   ComCatalogObject applicationObject,
                                   ComCatalogObject classObject,
                                   HostingMode hostingMode)
        {
            VerifyFunctionality();         
 
            this.info = new ServiceInfo(clsid,
                                        service,
                                        applicationObject,
                                        classObject,
                                        hostingMode);
            base.InitializeDescription(new UriSchemeKeyedCollection());
        }
        public ComPlusThreadInitializer(ContractDescription contract,
                                        DispatchOperation operation,
                                        ServiceInfo info)
        {
            this.info = info;
            iid = contract.ContractType.GUID;

            if (info.CheckRoles)
            {
                string[] serviceRoleMembers = null;
                string[] contractRoleMembers = null;
                string[] operationRoleMembers = null;

                // Figure out the role members we want...
                //
                serviceRoleMembers = info.ComponentRoleMembers;
                foreach (ContractInfo contractInfo in this.info.Contracts)
                {
                    if (contractInfo.IID == iid)
                    {
                        contractRoleMembers = contractInfo.InterfaceRoleMembers;
                        foreach (OperationInfo opInfo in contractInfo.Operations)
                        {
                            if (opInfo.Name == operation.Name)
                            {
                                operationRoleMembers = opInfo.MethodRoleMembers;
                                break;
                            }
                        }

                        if (operationRoleMembers == null)
                        {
                            // Did not find the operation
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.ListenerInitFailed(
                                SR.GetString(SR.ComOperationNotFound,
                                             contract.Name,
                                             operation.Name)));
                        }
                        break;
                    }
                }

                this.comAuth = new ComPlusAuthorization(serviceRoleMembers,
                                                        contractRoleMembers,
                                                        operationRoleMembers);
            }
        }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, InstanceContext instanceContext, int instanceID)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusInstanceReleasedSchema record =
             new ComPlusInstanceReleasedSchema(info.AppID, info.Clsid, instanceID);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceEndpointCollection endpointCollection)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         foreach (ServiceEndpoint endpoint in endpointCollection)
         {
             ComPlusServiceHostCreatedServiceEndpointSchema schema = new ComPlusServiceHostCreatedServiceEndpointSchema(info.AppID, info.Clsid, endpoint.Contract.Name, endpoint.Address.Uri, endpoint.Binding.Name);
             TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
         }
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Message message, int instanceID, Guid incomingTransactionID)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         WindowsIdentity callerIdentity = MessageUtil.GetMessageIdentity(message);
         Uri from = null;
         if (message.Headers.From != null)
             from = message.Headers.From.Uri;
         ComPlusInstanceCreationSuccessSchema record =
             new ComPlusInstanceCreationSuccessSchema(info.AppID, info.Clsid,
                 from, incomingTransactionID, callerIdentity.Name, instanceID);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record, null, null, message);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ContractDescription contract)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         XmlQualifiedName contractQname = new XmlQualifiedName(contract.Name, contract.Namespace);
         ComPlusServiceHostCreatedServiceContractSchema schema = new ComPlusServiceHostCreatedServiceContractSchema(info.AppID, info.Clsid, contractQname, contract.ContractType.ToString());
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, System.ServiceModel.Description.ServiceDescription service)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         WsdlExporter     exporter         = new WsdlExporter();
         string           ns               = "http://tempuri.org/";
         XmlQualifiedName wsdlServiceQName = new XmlQualifiedName("comPlusService", ns);
         exporter.ExportEndpoints(service.Endpoints, wsdlServiceQName);
         System.Web.Services.Description.ServiceDescription wsdl   = exporter.GeneratedWsdlDocuments[ns];
         ComPlusServiceHostStartedServiceDetailsSchema      schema = new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
     }
 }
 public ComPlusContractBehavior(ServiceInfo info)
 {
     this.info = info;
 }
Ejemplo n.º 20
0
 public ComPlusInstanceProvider(ServiceInfo info)
 {
     this.info = info;
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Message message, int instanceID, Guid incomingTransactionID)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         WindowsIdentity callerIdentity = MessageUtil.GetMessageIdentity(message);
         Uri             from           = null;
         if (message.Headers.From != null)
         {
             from = message.Headers.From.Uri;
         }
         ComPlusInstanceCreationSuccessSchema record =
             new ComPlusInstanceCreationSuccessSchema(info.AppID, info.Clsid,
                                                      from, incomingTransactionID, callerIdentity.Name, instanceID);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record, null, null, message);
     }
 }
 public ComPlusServiceLoader(ServiceInfo info)
 {
     this.info         = info;
     this.typeLoader   = new ComPlusTypeLoader(info);
     this.configLoader = new ConfigLoader(this.typeLoader);
 }
Ejemplo n.º 23
0
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity, Guid iid, int instanceID, Guid incomingTransactionID, Guid currentTransactionID)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallTxMismatchSchema schema = new ComPlusMethodCallTxMismatchSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, incomingTransactionID, currentTransactionID);
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity,
                          Guid iid, int instanceID, bool traceContextTransaction)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallSchema record = null;
         Guid guidContextTrsansactionID = Guid.Empty;
         if (traceContextTransaction)
         {
             IComThreadingInfo comThreadingInfo;
             comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
             if (comThreadingInfo != null)
             {
                 IObjectContextInfo contextInfo = comThreadingInfo as IObjectContextInfo;
                 if (contextInfo != null)
                 {
                     if (contextInfo.IsInTransaction())
                     {
                         contextInfo.GetTransactionId(out guidContextTrsansactionID);
                     }
                 }
             }
             if (guidContextTrsansactionID != Guid.Empty)
             {
                 record = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action,
                                                               instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, guidContextTrsansactionID);
             }
         }
         else
         {
             record = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action,
                                                  instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
         }
         if (record != null)
         {
             TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
         }
     }
 }
Ejemplo n.º 25
0
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity, Guid iid, int instanceID, bool traceContextTransaction)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusMethodCallSchema schema = null;
         Guid empty = Guid.Empty;
         if (traceContextTransaction)
         {
             IComThreadingInfo info2 = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
             if (info2 != null)
             {
                 IObjectContextInfo info3 = info2 as IObjectContextInfo;
                 if ((info3 != null) && info3.IsInTransaction())
                 {
                     info3.GetTransactionId(out empty);
                 }
             }
             if (empty != Guid.Empty)
             {
                 schema = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, empty);
             }
         }
         else
         {
             schema = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action, instanceID, Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
         }
         if (schema != null)
         {
             TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
         }
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, ServiceDescription service)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         WsdlExporter     exporter     = new WsdlExporter();
         string           serviceNs    = NamingHelper.DefaultNamespace;
         XmlQualifiedName serviceQName = new XmlQualifiedName("comPlusService", serviceNs);
         exporter.ExportEndpoints(service.Endpoints, serviceQName);
         WsdlNS.ServiceDescription wsdl = exporter.GeneratedWsdlDocuments[serviceNs];
         ComPlusServiceHostStartedServiceDetailsSchema record =
             new ComPlusServiceHostStartedServiceDetailsSchema(info.AppID, info.Clsid, wsdl);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
     }
 }
        public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, Uri from, string action, string callerIdentity,
                            Guid iid, int instanceID, bool traceContextTransaction)
        {
            if (DiagnosticUtility.ShouldTrace(type))
            {

                ComPlusMethodCallSchema record = null;
                Guid guidContextTrsansactionID = Guid.Empty;
                if (traceContextTransaction)
                {
                    IComThreadingInfo comThreadingInfo;
                    comThreadingInfo = (IComThreadingInfo)SafeNativeMethods.CoGetObjectContext(IID_IComThreadingInfo);
                    if (comThreadingInfo != null)
                    {
                        IObjectContextInfo contextInfo = comThreadingInfo as IObjectContextInfo;
                        if (contextInfo != null)
                        {
                            if (contextInfo.IsInTransaction())
                                contextInfo.GetTransactionId(out guidContextTrsansactionID);
                        }
                    }
                    if (guidContextTrsansactionID != Guid.Empty)
                    {
                        record = new ComPlusMethodCallContextTxSchema(from, info.AppID, info.Clsid, iid, action,
                        instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity, guidContextTrsansactionID);
                    }
                }
                else
                {
                    record = new ComPlusMethodCallSchema(from, info.AppID, info.Clsid, iid, action,
                    instanceID, System.Threading.Thread.CurrentThread.ManagedThreadId, SafeNativeMethods.GetCurrentThreadId(), callerIdentity);
                }
                if (record != null)
                    TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
            }
        }
 public ComPlusInstanceProvider(ServiceInfo info)
 {
     this.info = info;
 }
 protected void Initialize(Guid clsid, ServiceElement service, ComCatalogObject applicationObject, ComCatalogObject classObject, HostingMode hostingMode)
 {
     this.VerifyFunctionality();
     this.info = new ServiceInfo(clsid, service, applicationObject, classObject, hostingMode);
     base.InitializeDescription(new UriSchemeKeyedCollection(new Uri[0]));
 }
 public ComPlusServiceLoader(ServiceInfo info)
 {
     this.info = info;
     this.typeLoader = new ComPlusTypeLoader(info);
     this.configLoader = new ConfigLoader(this.typeLoader);
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusServiceHostSchema schema = new ComPlusServiceHostSchema(info.AppID, info.Clsid);
         TraceUtility.TraceEvent(type, traceCode, System.ServiceModel.SR.GetString(description), (TraceRecord)schema);
     }
 }
 public static void Trace(TraceEventType type, int traceCode, string description, ServiceInfo info, InstanceContext instanceContext, int instanceID)
 {
     if (DiagnosticUtility.ShouldTrace(type))
     {
         ComPlusInstanceReleasedSchema record =
         new ComPlusInstanceReleasedSchema(info.AppID, info.Clsid, instanceID);
         TraceUtility.TraceEvent(type, traceCode, ServiceModelSR.GetString(description), record);
     }
 }
Ejemplo n.º 33
0
 public ComPlusContractBehavior(ServiceInfo info)
 {
     this.info = info;
 }