private static WebSiteAuthenticationSettings GetWebsiteAuthenticationSettings()
        {
            WebServiceHostInspector inspector = new WebServiceHostInspector();

            inspector.Inspect();
            return(new WebSiteAuthenticationSettings(inspector.AuthenticationScheme, inspector.CredentialType));
        }
Exemple #2
0
        private static void VerifyAuthenticationMode()
        {
            // Authentication scheme should never be none.
            if (_authenticationSchemes == AuthenticationSchemes.None)
            {
                lock (_inspectorLock)
                {
                    if (_authenticationSchemes == AuthenticationSchemes.None)
                    {
                        WebServiceHostInspector inspector = new WebServiceHostInspector();
                        inspector.Inspect();
                        _authenticationSchemes = inspector.AuthenticationScheme;
                        _credentialType        = inspector.CredentialType;

                        // We can't close the host because it's in a faulted state. Trying to do so will
                        // cause a CommunicationException to be thrown.
                    }
                }
            }
        }