Пример #1
0
        public void AddSecureWSHttpEndpoint_forwards_to_configurator(IServiceHostConfigurator configurator, Action <WSHttpBinding> testDelegate, string host, string path, int port)
        {
            var address = EndpointAddress.ForHttp(host, path, port, false);

            configurator.AddSecureWSHttpEndpoint(typeof(ITestService), address, testDelegate);

            Mock.Get(configurator).Verify(p => p.AddEndpoint <WSHttpBinding>(typeof(ITestService), It.Is <HttpEndpointAddress>(a => a.IsSecure && a.Host == host && a.Port == port && a.Path == path), It.IsAny <Action <WSHttpBinding> >()));
        }
Пример #2
0
        public static HttpEndpointAddress UseECS(this HttpEndpointAddress endpointAddress, IConfiguration configuration)
        {
            if (Environment.GetEnvironmentVariable("ECS_CONTAINER_METADATA_FILE") == null)
            {
                return(endpointAddress);
            }

            var containerMetadata = configuration.Get <ECSContainerMetadata>();

            return(EndpointAddress.ForHttp(containerMetadata.HostPrivateIPv4Address, endpointAddress.Path, containerMetadata.PortMappings[0].HostPort, endpointAddress.IsSecure));
        }