SvcFile(Guid appid, Guid clsid, SvcFileState state, AtomicFile svcFile)
 {
     this.appid   = appid;
     this.clsid   = clsid;
     this.state   = state;
     this.svcFile = svcFile;
 }
        ComplusEndpointConfigContainer(ComAdminAppInfo appInfo)
        {
            this.appInfo = appInfo;
            this.scope = null;
            if (appInfo.ApplicationDirectory != null && appInfo.ApplicationDirectory.Length > 0)
            {
                this.appDir = appInfo.ApplicationDirectory;
                this.mustGenerateAppDir = false;

                if (!Directory.Exists(this.appDir))
                {
                    // We will not tolerate misconfigured COM+ apps (i.e. we wont create the dir for you, which is consistent with what COM+ does
                    throw Tool.CreateException(SR.GetString(SR.ApplicationDirectoryDoesNotExist, appDir), null);
                }
            }
            else
            {
                this.appDir = GeneratedAppDirectoryName();

                if (!Directory.Exists(this.appDir))
                    this.mustGenerateAppDir = true;
            }

            this.configFile = new AtomicFile(Path.Combine(this.appDir, "application.config"));
            this.manifestFile = new AtomicFile(Path.Combine(this.appDir, "application.manifest"));

            this.listenerComponentExists = appInfo.ListenerExists;
            this.hasServices = listenerComponentExists;   // notice how we initialize this

        }
Beispiel #3
0
        ComplusEndpointConfigContainer(ComAdminAppInfo appInfo)
        {
            this.appInfo = appInfo;
            this.scope   = null;
            if (appInfo.ApplicationDirectory != null && appInfo.ApplicationDirectory.Length > 0)
            {
                this.appDir             = appInfo.ApplicationDirectory;
                this.mustGenerateAppDir = false;

                if (!Directory.Exists(this.appDir))
                {
                    // We will not tolerate misconfigured COM+ apps (i.e. we wont create the dir for you, which is consistent with what COM+ does
                    throw Tool.CreateException(SR.GetString(SR.ApplicationDirectoryDoesNotExist, appDir), null);
                }
            }
            else
            {
                this.appDir = GeneratedAppDirectoryName();

                if (!Directory.Exists(this.appDir))
                {
                    this.mustGenerateAppDir = true;
                }
            }

            this.configFile   = new AtomicFile(Path.Combine(this.appDir, "application.config"));
            this.manifestFile = new AtomicFile(Path.Combine(this.appDir, "application.manifest"));

            this.listenerComponentExists = appInfo.ListenerExists;
            this.hasServices             = listenerComponentExists; // notice how we initialize this
        }
        public static void InstallListener(Guid appid, string path, RuntimeVersions runtimeVersion)
        {
            string application = appid.ToString("B");
            string partitionId = null;


            ICatalog2 catalog = GetCatalog();

            partitionId = GetPartitionIdForApplication(catalog, application, false);

            // Search for the listener in this partition..
            bool   is64bit  = GetApplicationBitness(catalog, partitionId, application);
            Guid   clsidVal = Guid.NewGuid();
            string clsid    = clsidVal.ToString("B");
            string tlb      = Path.Combine(path, application + "." + clsid + ".tlb");

            try
            {
                // No other listener in this partition, we're the first - install using RegistrationHelper
                AtomicFile.SafeDeleteFile(tlb);
                string modulePath = GetAppropriateBitnessModuleModulePath(is64bit, runtimeVersion);
                if (string.IsNullOrEmpty(modulePath))
                {
                    throw Tool.CreateException(SR.GetString(SR.CannotFindServiceInitializerModuleInRegistry), null);
                }
                CreateTypeLib(tlb, clsidVal);
                CreateRegistryKey(is64bit, clsidVal, modulePath);
                catalog.InstallComponent(application, modulePath, tlb, null);
                MarkComponentAsPrivate(catalog, partitionId, application, ListenerWSUName);
                if (!SetComponentProperty(application, ListenerWSUName, PropertyName.Description, ListenerComponentDescription))
                {
                    ToolConsole.WriteWarning(SR.GetString(SR.CannotSetComponentDescription, clsid, appid.ToString("B")));
                }
                if (!SetComponentProperty(application, ListenerWSUName, PropertyName.InitializesServerApplication, "1"))
                {
                    ToolConsole.WriteWarning(SR.GetString(SR.CannotSetComponentInitializerProperty, ListenerWSUName, appid.ToString("B")));
                }
                if (!SetComponentProperty(application, ListenerWSUName, PropertyName.ComponentAccessChecksEnabled, "0"))
                {
                    ToolConsole.WriteWarning(SR.GetString(SR.CannotDisableAccessChecksOnInitializer, ListenerWSUName, appid.ToString("B")));
                }
            }
            catch (Exception ex)
            {
                if (ex is NullReferenceException || ex is SEHException)
                {
                    throw ex;
                }

                throw Tool.CreateException(SR.GetString(SR.CouldNotInstallListener), ex);
            }
            finally
            {
                AtomicFile.SafeDeleteFile(tlb);
            }
        }
        WasEndpointConfigContainer(string webServerName, string webDirectoryName, string webDirectoryPath, RuntimeVersions runtimeVersion)
        {
            if (string.IsNullOrEmpty(webDirectoryPath) || !Directory.Exists(webDirectoryPath))
            {
                // We will not tolerate a webDir that does not exist
                throw Tool.CreateException(SR.GetString(SR.WebDirectoryPathNotFound, webDirectoryName, webDirectoryPath), null);
            }

            this.webDirectoryName = webDirectoryName;
            this.webDirectoryPath = webDirectoryPath;
            this.webServerName = webServerName;
            this.closed = false;
            this.configFile = new AtomicFile(this.webDirectoryPath + "\\web.config");
            this.svcFileManager = new SvcFileManager(this.webDirectoryPath);
            this.runtimeVersion = runtimeVersion;
        }
        WasEndpointConfigContainer(string webServerName, string webDirectoryName, string webDirectoryPath, RuntimeVersions runtimeVersion)
        {
            if (string.IsNullOrEmpty(webDirectoryPath) || !Directory.Exists(webDirectoryPath))
            {
                // We will not tolerate a webDir that does not exist
                throw Tool.CreateException(SR.GetString(SR.WebDirectoryPathNotFound, webDirectoryName, webDirectoryPath), null);
            }

            this.webDirectoryName = webDirectoryName;
            this.webDirectoryPath = webDirectoryPath;
            this.webServerName    = webServerName;
            this.closed           = false;
            this.configFile       = new AtomicFile(this.webDirectoryPath + "\\web.config");
            this.svcFileManager   = new SvcFileManager(this.webDirectoryPath);
            this.runtimeVersion   = runtimeVersion;
        }
 SvcFile(Guid appid, Guid clsid, SvcFileState state, AtomicFile svcFile)
 {
     this.appid = appid;
     this.clsid = clsid;
     this.state = state;
     this.svcFile = svcFile;
 }