Exemplo n.º 1
0
        internal override bool Initialize()
        {
            //
            // see if we already cached a DiscoveryServerType
            //
            if (null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type)) &&
                null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type, true)))
            {
                lock (InternalSyncObject) {
                    if (null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type)) &&
                        null == (serverType = (DiscoveryServerType)GetFromCache(typeof(DiscoveryServerProtocol), Type, true)))
                    {
                        //
                        // if not create a new DiscoveryServerType and cache it
                        //
                        bool   excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(DiscoveryServerProtocol), Type);
                        string escapedUri = RuntimeUtils.EscapeUri(Request.Url);
                        serverType = new DiscoveryServerType(Type, escapedUri, excludeSchemeHostPortFromCachingKey);
                        AddToCache(typeof(DiscoveryServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey);
                    }
                }
            }

            return(true);
        }
        internal override bool Initialize()
        {
            //
            // see if we already cached a DocumentationServerType
            //
            if (null == (serverType = (DocumentationServerType)GetFromCache(typeof(DocumentationServerProtocol), Type)) &&
                null == (serverType = (DocumentationServerType)GetFromCache(typeof(DocumentationServerProtocol), Type, true)))
            {
                lock (InternalSyncObject) {
                    if (null == (serverType = (DocumentationServerType)GetFromCache(typeof(DocumentationServerProtocol), Type)) &&
                        null == (serverType = (DocumentationServerType)GetFromCache(typeof(DocumentationServerProtocol), Type, true)))
                    {
                        //
                        // if not create a new DocumentationServerType and cache it
                        //
                        //
                        bool   excludeSchemeHostPortFromCachingKey = this.IsCacheUnderPressure(typeof(DocumentationServerProtocol), Type);
                        string escapedUri = RuntimeUtils.EscapeUri(Request.Url);
                        serverType = new DocumentationServerType(Type, escapedUri, excludeSchemeHostPortFromCachingKey);
                        AddToCache(typeof(DocumentationServerProtocol), Type, serverType, excludeSchemeHostPortFromCachingKey);
                    }
                }
            }

            WebServicesSection config = WebServicesSection.Current;

            if (config.WsdlHelpGenerator.Href != null && config.WsdlHelpGenerator.Href.Length > 0)
            {
                TraceMethod caller = Tracing.On ? new TraceMethod(this, "Initialize") : null;
                if (Tracing.On)
                {
                    Tracing.Enter("ASP.NET", caller, new TraceMethod(typeof(PageParser), "GetCompiledPageInstance", config.WsdlHelpGenerator.HelpGeneratorVirtualPath, config.WsdlHelpGenerator.HelpGeneratorPath, Context));
                }

                handler = GetCompiledPageInstance(config.WsdlHelpGenerator.HelpGeneratorVirtualPath,
                                                  config.WsdlHelpGenerator.HelpGeneratorPath,
                                                  Context);
                if (Tracing.On)
                {
                    Tracing.Exit("ASP.NET", caller);
                }
            }
            return(true);
        }