Пример #1
0
        /// <summary>
        /// Loads saved web service settings from the config file if the <see cref="Adapter.PersistSettings"/> property is set to true.
        /// </summary>
        public override void LoadSettings()
        {
            base.LoadSettings();

            if (PersistSettings)
            {
                // Load settings from the specified category.
                ConfigurationFile config = ConfigurationFile.Current;
                CategorizedSettingsElementCollection settings = config.Settings[SettingsCategory];

                settings.Add("Endpoints", m_endpoints, "Semicolon delimited list of URIs where the web service can be accessed.");
                settings.Add("Contract", m_contractInterface, "Assembly qualified name of the contract interface implemented by the web service.");
                settings.Add("Singleton", m_singleton, "True if the web service is singleton; otherwise False.");
                settings.Add("SecurityPolicy", m_securityPolicy, "Assembly qualified name of the authorization policy to be used for securing the web service.");
                settings.Add("PublishMetadata", m_publishMetadata, "True if the web service metadata is to be published at all the endpoints; otherwise False.");
                settings.Add("AllowCrossDomainAccess", m_allowCrossDomainAccess, "True to allow Silverlight and Flash cross-domain access to the web service.");
                settings.Add("AllowedDomainList", m_allowedDomainList, "Comma separated list of domain names for Silverlight and Flash cross-domain access to use when allowCrossDomainAccess is true. Use * for domain wildcards, e.g., *.consoto.com.");
                settings.Add("Enabled", ServiceEnabled.ToString(), "Determines if web service should be enabled at startup.");

                Endpoints              = settings["Endpoints"].ValueAs(m_endpoints);
                ContractInterface      = settings["Contract"].ValueAs(m_contractInterface);
                Singleton              = settings["Singleton"].ValueAs(m_singleton);
                SecurityPolicy         = settings["SecurityPolicy"].ValueAs(m_securityPolicy);
                PublishMetadata        = settings["PublishMetadata"].ValueAs(m_publishMetadata);
                AllowCrossDomainAccess = settings["AllowCrossDomainAccess"].ValueAs(m_allowCrossDomainAccess);
                AllowedDomainList      = settings["AllowedDomainList"].ValueAs(m_allowedDomainList);

                // Technically removing all end points will "disable" a web service since it would bind to nothing, however,
                // this allows you to keep configured end points and still disable the service from configuration
                m_serviceEnabled = settings["Enabled"].ValueAsBoolean(ServiceEnabled);
            }
        }
Пример #2
0
        protected override void EnableLocalSettings()
        {
            SetSettingFlag(true);

            ServiceEnabled?.Invoke();
        }