Example #1
0
        public void Behavior_Bad_HttpOperationHandlerFactory_Throws()
        {
            HttpBehaviorElement el = new HttpBehaviorElement();

            ExceptionAssert.Throws <ConfigurationErrorsException>(
                "Setting HttpOperationHandlerFactory to wrong type throws",
                Http.SR.HttpMessageConfigurationPropertyTypeMismatch(typeof(string).FullName, "operationHandlerFactory", typeof(HttpOperationHandlerFactory)),
                () => HttpBehaviorElement.GetHttpOperationHandlerFactory(typeof(string).FullName));
        }
Example #2
0
        private void InternalOnApplyConfiguration(ServiceEndpoint endpoint)
        {
            HttpEndpoint httpEndpoint = endpoint as HttpEndpoint;

            Fx.Assert(httpEndpoint != null, "The endpoint should be of type httpEndpoint since this is what was returned with CreateServiceEndpoint().");

            if (this.IsSet(HttpConfigurationStrings.HelpEnabled))
            {
                httpEndpoint.HelpEnabled = this.HelpEnabled;
            }

            if (this.IsSet(HttpConfigurationStrings.TrailingSlashMode))
            {
                httpEndpoint.TrailingSlashMode = this.TrailingSlashMode;
            }

            if (this.IsSet(HttpConfigurationStrings.OperationHandlerFactory))
            {
                httpEndpoint.OperationHandlerFactory = HttpBehaviorElement.GetHttpOperationHandlerFactory(this.OperationHandlerFactory);
            }

            if (this.IsSet(ConfigurationStrings.HostNameComparisonMode))
            {
                httpEndpoint.HostNameComparisonMode = this.HostNameComparisonMode;
            }

            if (this.IsSet(ConfigurationStrings.MaxBufferPoolSize))
            {
                httpEndpoint.MaxBufferPoolSize = this.MaxBufferPoolSize;
            }

            if (this.IsSet(ConfigurationStrings.MaxBufferSize))
            {
                httpEndpoint.MaxBufferSize = this.MaxBufferSize;
            }

            if (this.IsSet(ConfigurationStrings.MaxReceivedMessageSize))
            {
                httpEndpoint.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
            }

            if (this.IsSet(ConfigurationStrings.TransferMode))
            {
                httpEndpoint.TransferMode = this.TransferMode;
            }

            this.Security.ApplyConfiguration(httpEndpoint.Security);
        }
Example #3
0
        /// <summary>
        /// Creates the <see cref="HttpBehavior"/> instance.
        /// </summary>
        /// <returns>A new <see cref="HttpBehavior"/> instance.</returns>
        protected override object CreateBehavior()
        {
            HttpBehavior httpBehavior = new HttpBehavior();

            if (this.IsSet(HttpConfigurationStrings.HelpEnabled))
            {
                httpBehavior.HelpEnabled = this.HelpEnabled;
            }

            if (this.IsSet(HttpConfigurationStrings.TrailingSlashMode))
            {
                httpBehavior.TrailingSlashMode = this.TrailingSlashMode;
            }

            if (this.IsSet(HttpConfigurationStrings.OperationHandlerFactory))
            {
                httpBehavior.OperationHandlerFactory = HttpBehaviorElement.GetHttpOperationHandlerFactory(this.OperationHandlerFactory);
            }

            return(httpBehavior);
        }