Exemplo n.º 1
0
        /// <summary>
        /// Creates the WCF endpoint and configures port sharing depending on the
        /// Core.WCFEnablePortSharing setting.
        /// </summary>
        /// <returns>The Castle endpoint facility contract</returns>

        private IWcfEndpoint CreateEndpoint(
            BindingEndpointModel baseEndpoint,
            IEndpointBehavior endpointBehaviour,
            List <string> baseAddresses,
            string serviceUri)
        {
            IWcfEndpoint endpoint = baseEndpoint;

            if (Settings.WCFEnablePortSharing)
            {
                baseAddresses.Add(serviceUri);
                baseEndpoint.AddExtensions(endpointBehaviour);
            }
            else
            {
                // add ACL's to allow http service registrations without account elevation (for mex endpoints)
                // run these commands in an elevated console (only need to run this once)
                // NOTE: this is only required when not running as an administrator
                // netsh http add urlacl url = http://+:8002/ user=\Everyone
                // netsh http add urlacl url = http://+:8003/ user=\Everyone
                // netsh http add urlacl url = http://+:8502/ user=\Everyone

                endpoint = baseEndpoint
                           // The .At(uri) enables a fully qualified endpoint Uri which avoids using a base address configuration
                           // By limiting base addresses to only HTTP (mex) endpoints we eliminate the requirement of port sharing
                           .At(serviceUri)
                           .AddExtensions(endpointBehaviour);
            }

            return(endpoint);
        }
			void IWcfEndpointVisitor.VisitBindingEndpoint(BindingEndpointModel model)
			{
				serviceEndpoint = builder.AddServiceEndpoint(serviceHost, model);
			}
		protected virtual ServiceEndpoint AddServiceEndpoint(ServiceHost serviceHost, BindingEndpointModel model)
		{
			var binding = GetEffectiveBinding(model.Binding, serviceHost, string.Empty);
			return serviceHost.AddServiceEndpoint(model.Contract, binding, string.Empty);
		}
		void IWcfEndpointVisitor.VisitBindingEndpoint(BindingEndpointModel model)
		{
			channelCreator = GetChannel(contract, GetEffectiveBinding(model.Binding, null), string.Empty);
		}