示例#1
0
 Usage(EndpointConfiguration endpointConfiguration)
 {
     #region DefiningEncryptedPropertiesAs
     ConventionsBuilder conventions = endpointConfiguration.Conventions();
     conventions.DefiningEncryptedPropertiesAs(info => info.Name.EndsWith("EncryptedProperty"));
     #endregion
 }
 void RawXml(EndpointConfiguration endpointConfiguration)
 {
     #region ConfigureRawXmlSerialization
     endpointConfiguration.UseSerialization<XmlSerializer>()
         .DontWrapRawXml();
     #endregion
 }
        DisableDurable(EndpointConfiguration endpointConfiguration)
        {
            #region set-to-non-durable
            endpointConfiguration.DisableDurableMessages();

            #endregion
        }
        public async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
        {
            var settings = runDescriptor.Settings;

            var types = endpointConfiguration.GetTypesScopedByTestClass();

            typesToInclude.AddRange(types);

            var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);
            builder.TypesToIncludeInScan(typesToInclude);
            builder.CustomConfigurationSource(configSource);
            builder.EnableInstallers();

            builder.DisableFeature<TimeoutManager>();
            builder.Recoverability()
                .Delayed(delayed => delayed.NumberOfRetries(0))
                .Immediate(immediate => immediate.NumberOfRetries(0));

            await builder.DefineTransport(settings, endpointConfiguration.EndpointName).ConfigureAwait(false);

            builder.RegisterComponentsAndInheritanceHierarchy(runDescriptor);

            configurationBuilderCustomization(builder);

            return builder;
        }
 public static void Subscribe(EndpointConfiguration endpointConfiguration)
 {
     ErrorsNotifications errors = endpointConfiguration.Notifications.Errors;
     errors.MessageHasBeenSentToSecondLevelRetries += (sender, retry) => Log(retry);
     errors.MessageHasFailedAFirstLevelRetryAttempt += (sender, retry) => Log(retry);
     errors.MessageSentToErrorQueue += (sender, retry) => Log(retry);
 }
示例#6
0
 static async Task Run(EndpointConfiguration endpointConfiguration)
 {
     IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
     Console.WriteLine("Press any key to exit");
     Console.ReadKey();
     await endpoint.Stop();
 }
示例#7
0
    static async Task AsyncMain()
    {
        AggregateCatalog catalog = new AggregateCatalog();
        catalog.Catalogs.Add(new DirectoryCatalog("."));

        CompositionContainer compositionContainer = new CompositionContainer(catalog);

        Console.Title = "Samples.MefExtensionEndpoint";
        LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MefExtensionEndpoint");
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        await RunCustomizeConfiguration(compositionContainer, endpointConfiguration);
        await RunBeforeEndpointStart(compositionContainer);
        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        await RunAfterEndpointStart(compositionContainer, endpoint);
        try
        {
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await RunBeforeEndpointStop(compositionContainer, endpoint);
            await endpoint.Stop();
        }
        await RunAfterEndpointStop(compositionContainer);
    }
 public void Simple()
 {
     #region MutatorRegistration
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.RegisterComponents(c => c.ConfigureComponent<MyMutator>(DependencyLifecycle.InstancePerCall));
     #endregion
 }
示例#9
0
        Usage(EndpointConfiguration endpointConfiguration)
        {
            #region UsingMessageBodyEncryptor
            endpointConfiguration.RegisterComponents(c => c.ConfigureComponent<MessageEncryptor>(DependencyLifecycle.InstancePerCall));

            #endregion
        }
示例#10
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.MessageMutators";
        var endpointConfiguration = new EndpointConfiguration("Samples.MessageMutators");
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.SendFailedMessagesTo("error");

        #region ComponentRegistartion
        endpointConfiguration.RegisterComponents(components =>
        {
            components.ConfigureComponent<ValidationMessageMutator>(DependencyLifecycle.InstancePerCall);
            components.ConfigureComponent<TransportMessageCompressionMutator>(DependencyLifecycle.InstancePerCall);
        });
        #endregion

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            await Runner.Run(endpointInstance)
                .ConfigureAwait(false);
        }
        finally
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
示例#11
0
    static async Task AsyncMain()
    {

        #region sqlrelay-config
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.EndpointName("SqlRelay");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.DisableFeature<AutoSubscribe>();
        endpointConfiguration.UsePersistence<NHibernatePersistence>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
        endpointConfiguration.UseTransport<SqlServerTransport>()
            .ConnectionString(@"Data Source=.\SQLEXPRESS;Initial Catalog=PersistenceForSqlTransport;Integrated Security=True");
        #endregion


        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            Console.WriteLine("\r\nSqlRelay is running - This endpoint will relay all events received to subscribers. Press any key to stop program\r\n");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
示例#12
0
 static async Task AsyncMain()
 {
     Console.Title = "Samples.MessageBodyEncryption.Endpoint2";
     EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MessageBodyEncryption.Endpoint1");
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
     #region RegisterMessageEncryptor
     endpointConfiguration.RegisterMessageEncryptor();
     #endregion
     endpointConfiguration.SendFailedMessagesTo("error");
     IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
     try
     {
         CompleteOrder completeOrder = new CompleteOrder
                                       {
                                           CreditCard = "123-456-789"
                                       };
         await endpoint.Send("Samples.MessageBodyEncryption.Endpoint2", completeOrder);
         Console.WriteLine("Message sent");
         Console.WriteLine("Press any key to exit");
         Console.ReadKey();
     }
     finally
     {
         await endpoint.Stop();
     }
 }
 public void Customize(EndpointConfiguration endpointConfiguration)
 {
     endpointConfiguration.UseSerialization<JsonSerializer>();
     endpointConfiguration.EnableInstallers();
     endpointConfiguration.SendFailedMessagesTo("error");
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
 }
示例#14
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.Spring";
        #region ContainerConfiguration
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.Spring");
        GenericApplicationContext applicationContext = new GenericApplicationContext();
        applicationContext.ObjectFactory.RegisterSingleton("MyService", new MyService());
        endpointConfiguration.UseContainer<SpringBuilder>(c => c.ExistingApplicationContext(applicationContext));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();

        endpointConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            await endpoint.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
示例#15
0
    protected void Application_Start()
    {
        #region ApplicationStart

        ContainerBuilder builder = new ContainerBuilder();

        // Register MVC controllers.
        builder.RegisterControllers(typeof(MvcApplication).Assembly);

        // Set the dependency resolver to be Autofac.
        IContainer container = builder.Build();

        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.MvcInjection.WebApplication");
        // instruct NServiceBus to use a custom AutoFac configuration
        endpointConfiguration.UseContainer<AutofacBuilder>(c => c.ExistingLifetimeScope(container));
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        endpoint = Endpoint.Start(endpointConfiguration).GetAwaiter().GetResult();

        ContainerBuilder updater = new ContainerBuilder();
        updater.RegisterInstance(endpoint);
        updater.Update(container);

        DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

        AreaRegistration.RegisterAllAreas();
        RegisterRoutes(RouteTable.Routes);

        #endregion
    }
        public void Version_5_2()
        {
            #region ConfiguringNHibernate

            EndpointConfiguration configuration = new EndpointConfiguration();

            //Use NHibernate for all persistence concerns
            configuration.UsePersistence<NHibernatePersistence>();

            //or select specific concerns
            configuration.UsePersistence<NHibernatePersistence, StorageType.Sagas>();
            configuration.UsePersistence<NHibernatePersistence, StorageType.Subscriptions>();
            configuration.UsePersistence<NHibernatePersistence, StorageType.Timeouts>();
            configuration.UsePersistence<NHibernatePersistence, StorageType.Outbox>();
            configuration.UsePersistence<NHibernatePersistence, StorageType.GatewayDeduplication>();

            #endregion

            #region NHibernateSubscriptionCaching

            configuration.UsePersistence<NHibernatePersistence, StorageType.Subscriptions>()
                .EnableCachingForSubscriptionStorage(TimeSpan.FromMinutes(1));

            #endregion
        }
示例#17
0
 public StaticHeaders()
 {
     #region header-static-endpoint
     EndpointConfiguration configuration = new EndpointConfiguration();
     configuration.AddHeaderToAllOutgoingMessages("MyGlobalHeader", "some static value");
     #endregion
 }
        static async Task ConfigureTestExecution(TestDependencyType type, EndpointConfiguration config, RunSettings settings, string endpointName, PublisherMetadata publisherMetadata)
        {
            var dependencyTypeString = type.ToString();

            var dependencyType = settings.Get<Type>(dependencyTypeString);

            var typeName = "ConfigureEndpoint" + dependencyType.Name;

            var configurerType = Type.GetType(typeName, false);

            if (configurerType == null)
            {
                throw new InvalidOperationException($"Acceptance Test project must include a non-namespaced class named '{typeName}' implementing {typeof(IConfigureEndpointTestExecution).Name}. See {typeof(ConfigureEndpointMsmqTransport).FullName} for an example.");
            }

            var configurer = Activator.CreateInstance(configurerType) as IConfigureEndpointTestExecution;

            if (configurer == null)
            {
                throw new InvalidOperationException($"{typeName} does not implement {typeof(IConfigureEndpointTestExecution).Name}.");
            }

            await configurer.Configure(endpointName, config, settings, publisherMetadata).ConfigureAwait(false);

            ActiveTestExecutionConfigurer cleaners;
            var cleanerKey = "ConfigureTestExecution." + endpointName;
            if (!settings.TryGet(cleanerKey, out cleaners))
            {
                cleaners = new ActiveTestExecutionConfigurer();
                settings.Set(cleanerKey, cleaners);
            }
            cleaners.Add(configurer);
        }
示例#19
0
        public Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration, IConfigurationSource configSource, Action<EndpointConfiguration> configurationBuilderCustomization)
        {
            var types = GetTypesScopedByTestClass(endpointConfiguration);

            typesToInclude.AddRange(types);

            var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);

            builder.TypesToIncludeInScan(typesToInclude);
            builder.CustomConfigurationSource(configSource);
            builder.EnableInstallers();

            builder.DisableFeature<TimeoutManager>();
            builder.Recoverability()
                .Delayed(delayed => delayed.NumberOfRetries(0))
                .Immediate(immediate => immediate.NumberOfRetries(0));

            builder.RegisterComponents(r => { RegisterInheritanceHierarchyOfContextOnContainer(runDescriptor, r); });

            builder.UsePersistence<InMemoryPersistence>();

            configurationBuilderCustomization(builder);

            return Task.FromResult(builder);
        }
 async Task AsyncOnStart()
 {
     var endpointConfiguration = new EndpointConfiguration("EndpointName");
     endpointConfiguration.EnableInstallers();
     endpointInstance = await Endpoint.Start(endpointConfiguration)
         .ConfigureAwait(false);
 }
示例#21
0
    static async Task AsyncMain()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.WcfCallbacks");
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        #region startbus


        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            using (StartWcfHost(endpoint))
            {
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
        }
        finally
        {
            await endpoint.Stop();
        }

        #endregion
    }
示例#22
0
    static async Task AsyncMain()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        endpointConfiguration.Routing()
            .UnicastRoutingTable
            .RouteToEndpoint(typeof(DoSomething), "Server");

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        Console.WriteLine("Press enter to send a message");
        Console.WriteLine("Press any key to exit");
        while (true)
        {
            ConsoleKeyInfo key = Console.ReadKey();
            if (key.Key != ConsoleKey.Enter)
            {
                break;
            }
            await endpoint.Send(new DoSomething());
            Console.WriteLine("Message Sent");
        }
        await endpoint.Stop();
    }
示例#23
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.StructureMap";
        #region ContainerConfiguration
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration("Samples.StructureMap");
        Container container = new Container(x => x.For<MyService>().Use(new MyService()));
        endpointConfiguration.UseContainer<StructureMapBuilder>(c => c.ExistingContainer(container));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            await endpoint.SendLocal(new MyMessage());
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();

        }
        finally
        {
            await endpoint.Stop();
        }
    }
示例#24
0
    static async Task AsyncMain()
    {
        LogManager.Use<DefaultFactory>().Level(LogLevel.Error);
        #region Program
        Logger.WriteLine("Starting configuration");
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.StartupShutdown");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.EnableFeature<MyFeature>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        Logger.WriteLine("Calling Bus.Create");
        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            //simulate some bus activity
            Thread.Sleep(500);

            Logger.WriteLine("Bus is processing messages");
        }
        finally
        {
            Logger.WriteLine("Calling IEndpointInstance.Stop");
            await endpoint.Stop();
        }
        Logger.WriteLine("Finished");
        #endregion
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
示例#25
0
    static async Task AsyncMain()
    {
        EndpointConfiguration busConfiguration = new EndpointConfiguration();
        busConfiguration.EndpointName("Samples.ComplexSagaFindingLogic");
        busConfiguration.UseSerialization<JsonSerializer>();
        busConfiguration.EnableInstallers();
        busConfiguration.UsePersistence<InMemoryPersistence>();
        busConfiguration.SendFailedMessagesTo("error");

        IEndpointInstance endpoint = await Endpoint.Start(busConfiguration);
        try
        {
            await endpoint.SendLocal(new StartOrder
                          {
                              OrderId = "123"
                          });
            await endpoint.SendLocal(new StartOrder
                          {
                              OrderId = "456"
                          });
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
示例#26
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.Unity";
        #region ContainerConfiguration
        var endpointConfiguration = new EndpointConfiguration("Samples.Unity");
        var container = new UnityContainer();
        container.RegisterInstance(new MyService());
        endpointConfiguration.UseContainer<UnityBuilder>(c => c.UseExistingContainer(container));
        #endregion
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            var myMessage = new MyMessage();
            await endpointInstance.SendLocal(myMessage)
                .ConfigureAwait(false);
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
    }
示例#27
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.StartupShutdown";
        LogManager.Use<DefaultFactory>().Level(LogLevel.Error);
        #region Program
        Logger.WriteLine("Starting configuration");
        var endpointConfiguration = new EndpointConfiguration("Samples.StartupShutdown");
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.EnableFeature<MyFeature>();
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.SendFailedMessagesTo("error");

        Logger.WriteLine("Calling Endpoint.Start");
        var endpointInstance = await Endpoint.Start(endpointConfiguration)
            .ConfigureAwait(false);
        try
        {
            //simulate some activity
            await Task.Delay(500)
                .ConfigureAwait(false);

            Logger.WriteLine("Endpoint is processing messages");
        }
        finally
        {
            Logger.WriteLine("Calling IEndpointInstance.Stop");
            await endpointInstance.Stop()
                .ConfigureAwait(false);
        }
        Logger.WriteLine("Finished");
        #endregion
        Console.WriteLine($"Logged information to {Logger.OutputFilePath}");
        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
    }
 void MapPublishers(EndpointConfiguration endpointConfiguration)
 {
     #region PubSub-CodePublisherMapping
     endpointConfiguration.UnicastRouting().AddPublisher("Sales", typeof(MyEvent));
     endpointConfiguration.UnicastRouting().AddPublisher("Sales", typeof(OtherEvent).Assembly);
     #endregion
 }
示例#29
0
 static async Task AsyncMain()
 {
     Console.Title = "Samples.CustomExtensionEndpoint";
     LogManager.Use<DefaultFactory>().Level(LogLevel.Info);
     var endpointConfiguration = new EndpointConfiguration("Samples.CustomExtensionEndpoint");
     endpointConfiguration.UsePersistence<InMemoryPersistence>();
     endpointConfiguration.EnableInstallers();
     await RunCustomizeConfiguration(endpointConfiguration)
         .ConfigureAwait(false);
     await RunBeforeEndpointStart()
         .ConfigureAwait(false);
     var endpointInstance = await Endpoint.Start(endpointConfiguration)
         .ConfigureAwait(false);
     await RunAfterEndpointStart(endpointInstance)
         .ConfigureAwait(false);
     try
     {
         Console.WriteLine("Press any key to exit");
         Console.ReadKey();
     }
     finally
     {
         await RunBeforeEndpointStop( endpointInstance)
             .ConfigureAwait(false);
         await endpointInstance.Stop()
             .ConfigureAwait(false);
     }
     await RunAfterEndpointStop()
         .ConfigureAwait(false);
 }
示例#30
0
    static async Task AsyncMain()
    {
        EndpointConfiguration endpointConfiguration = new EndpointConfiguration();
        endpointConfiguration.EndpointName("Samples.CustomTransport.Endpoint1");
#region UseDefinition
        endpointConfiguration.UseTransport<FileTransport>();
#endregion
        endpointConfiguration.UsePersistence<InMemoryPersistence>();
        endpointConfiguration.UseSerialization<JsonSerializer>();
        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.DisableFeature<TimeoutManager>();

        IEndpointInstance endpoint = await Endpoint.Start(endpointConfiguration);
        try
        {
            #region StartMessageInteraction
            await endpoint.Send("Samples.CustomTransport.Endpoint2", new MessageA());
            #endregion
            Console.WriteLine("MessageA sent. Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpoint.Stop();
        }
    }
示例#31
0
 public SetAbsenceAttendance_OS_SIClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(SetAbsenceAttendance_OS_SIClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#32
0
 public WcfProjectNServiceClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
     base(WcfProjectNServiceClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#33
0
 public WcfProjectNServiceClient(EndpointConfiguration endpointConfiguration) :
     base(WcfProjectNServiceClient.GetBindingForEndpoint(endpointConfiguration), WcfProjectNServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#34
0
 private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
 {
     if ((endpointConfiguration == EndpointConfiguration.defaultEndpoint))
     {
         System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
         System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();
         result.Elements.Add(textBindingElement);
         System.ServiceModel.Channels.HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement();
         httpBindingElement.AllowCookies           = true;
         httpBindingElement.MaxBufferSize          = int.MaxValue;
         httpBindingElement.MaxReceivedMessageSize = int.MaxValue;
         result.Elements.Add(httpBindingElement);
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.defaultBasic))
     {
         System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         result.AllowCookies           = true;
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.basicHttpEndpoint))
     {
         System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         result.AllowCookies           = true;
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.basicHttpsEndpoint))
     {
         System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         result.AllowCookies           = true;
         result.Security.Mode          = System.ServiceModel.BasicHttpSecurityMode.Transport;
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.httpsoap11Endpoint))
     {
         System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         result.AllowCookies           = true;
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.httpsoap12Endpoint))
     {
         System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
         System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();
         result.Elements.Add(textBindingElement);
         System.ServiceModel.Channels.HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement();
         httpBindingElement.AllowCookies           = true;
         httpBindingElement.MaxBufferSize          = int.MaxValue;
         httpBindingElement.MaxReceivedMessageSize = int.MaxValue;
         result.Elements.Add(httpBindingElement);
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.httpbinaryEndpoint))
     {
         System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
         result.Elements.Add(new System.ServiceModel.Channels.BinaryMessageEncodingBindingElement());
         System.ServiceModel.Channels.HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement();
         httpBindingElement.AllowCookies           = true;
         httpBindingElement.MaxBufferSize          = int.MaxValue;
         httpBindingElement.MaxReceivedMessageSize = int.MaxValue;
         result.Elements.Add(httpBindingElement);
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.httpssoap11Endpoint))
     {
         System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         result.AllowCookies           = true;
         result.Security.Mode          = System.ServiceModel.BasicHttpSecurityMode.Transport;
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.httpssoap12Endpoint))
     {
         System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
         System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();
         result.Elements.Add(textBindingElement);
         System.ServiceModel.Channels.HttpsTransportBindingElement httpsBindingElement = new System.ServiceModel.Channels.HttpsTransportBindingElement();
         httpsBindingElement.AllowCookies           = true;
         httpsBindingElement.MaxBufferSize          = int.MaxValue;
         httpsBindingElement.MaxReceivedMessageSize = int.MaxValue;
         result.Elements.Add(httpsBindingElement);
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.nettcpdefaultBinding))
     {
         System.ServiceModel.NetTcpBinding result = new System.ServiceModel.NetTcpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         return(result);
     }
     if ((endpointConfiguration == EndpointConfiguration.nettcpdefaultBinding1))
     {
         System.ServiceModel.NetTcpBinding result = new System.ServiceModel.NetTcpBinding();
         result.MaxBufferSize          = int.MaxValue;
         result.ReaderQuotas           = System.Xml.XmlDictionaryReaderQuotas.Max;
         result.MaxReceivedMessageSize = int.MaxValue;
         result.Security.Mode          = System.ServiceModel.SecurityMode.None;
         return(result);
     }
     throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
 }
 public commonserviceRD3SoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(commonserviceRD3SoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public commonserviceRD3SoapClient(EndpointConfiguration endpointConfiguration) :
     base(commonserviceRD3SoapClient.GetBindingForEndpoint(endpointConfiguration), commonserviceRD3SoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#37
0
        /// <summary>
        /// Connects to a single OPC UA Server's endpoint
        /// </summary>
        public static async Task EndpointConnect(Uri endpointUrl)
        {
            EndpointDescription selectedEndpoint   = CoreClientUtils.SelectEndpoint(endpointUrl.AbsoluteUri, true);
            ConfiguredEndpoint  configuredEndpoint = new ConfiguredEndpoint(selectedEndpoint.Server, EndpointConfiguration.Create(m_configuration));

            configuredEndpoint.Update(selectedEndpoint);

            Session newSession = await Session.Create(
                m_configuration,
                configuredEndpoint,
                true,
                false,
                m_configuration.ApplicationName,
                60000,
                new UserIdentity(new AnonymousIdentityToken()),
                null);

            if (newSession != null)
            {
                Trace("Created session with updated endpoint " + selectedEndpoint.EndpointUrl + " from server!");
                newSession.KeepAlive += new KeepAliveEventHandler((sender, e) => StandardClient_KeepAlive(sender, e, newSession));
                m_sessions.Add(newSession);
            }
        }
示例#38
0
 public KPSPublicSoapClient(EndpointConfiguration endpointConfiguration) :
     base(KPSPublicSoapClient.GetBindingForEndpoint(endpointConfiguration), KPSPublicSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#39
0
    static async Task Start()
    {
        Log.Logger = new LoggerConfiguration()
                     .MinimumLevel.Information()
                     .WriteTo.Console()
                     .CreateLogger();

        LogManager.Use <SerilogFactory>();

        Console.Title = "Frontend";

        var config = new EndpointConfiguration("OnlyOnce.Demo0.Frontend");

        config.SendFailedMessagesTo("error");
        var routing = config.UseTransport <LearningTransport>().Routing();

        routing.RouteToEndpoint(typeof(SubmitOrder).Assembly, "OnlyOnce.Demo0.Orders");

        config.EnableInstallers();

        var endpoint = await Endpoint.Start(config).ConfigureAwait(false);

        Console.WriteLine("'submit <order-id>' to create a new order.");
        Console.WriteLine($"'add ({string.Join("|", Enum.GetNames(typeof(Filling)))}) to <order-id>' to add item with selected filling.");

        while (true)
        {
            var command = Console.ReadLine();

            if (string.IsNullOrEmpty(command))
            {
                break;
            }

            var match = submitExpr.Match(command);
            if (match.Success)
            {
                var orderId = match.Groups[1].Value;
                var message = new SubmitOrder
                {
                    OrderId = orderId
                };
                await endpoint.Send(message).ConfigureAwait(false);

                continue;
            }
            match = addExpr.Match(command);
            if (match.Success)
            {
                var filling = match.Groups[1].Value;
                var orderId = match.Groups[2].Value;
                var message = new AddItem
                {
                    OrderId = orderId,
                    Filling = (Filling)Enum.Parse(typeof(Filling), filling)
                };
                await endpoint.Send(message).ConfigureAwait(false);

                continue;
            }
            Console.WriteLine("Unrecognized command.");
        }

        await endpoint.Stop().ConfigureAwait(false);
    }
示例#40
0
 public SetAbsenceAttendance_OS_SIClient(EndpointConfiguration endpointConfiguration) :
     base(SetAbsenceAttendance_OS_SIClient.GetBindingForEndpoint(endpointConfiguration), SetAbsenceAttendance_OS_SIClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
 public Endpoint <T> WithConfiguration()
 {
     this.endpointConfiguration = new EndpointConfiguration(name);
     return(this);
 }
示例#42
0
 /// <summary>
 /// Requests that the incoming queue be purged of all messages when the bus is started.
 /// All messages in this queue will be deleted if this is true.
 /// Setting this to true may make sense for certain smart-client applications,
 /// but rarely for server applications.
 /// </summary>
 /// <param name="config">The <see cref="EndpointConfiguration" /> instance to apply the settings to.</param>
 /// <param name="value">True to purge all message on startup; otherwise False.</param>
 public static void PurgeOnStartup(this EndpointConfiguration config, bool value)
 {
     Guard.AgainstNull(nameof(config), config);
     config.Settings.Get <ReceiveComponent.Settings>().PurgeOnStartup = value;
 }
        public static EndpointConfiguration SetupSendOnly(this EndpointConfiguration config)
        {
            config.SendOnly();

            return(config);
        }
 public void Customize(EndpointConfiguration configuration)
 {
     configuration.RegisterComponents(c =>
         c.ConfigureComponent<ContentTypeMutator>(DependencyLifecycle.InstancePerCall));
 }
        public static EndpointConfiguration SetupInstallers(this EndpointConfiguration config)
        {
            config.EnableInstallers();

            return(config);
        }
        public static EndpointConfiguration SetupErrorQueue(this EndpointConfiguration config)
        {
            config.SendFailedMessagesTo("errors");

            return(config);
        }
示例#47
0
 public void Customize(EndpointConfiguration configuration)
 {
 }
        public static EndpointConfiguration SetupPurgeOnStartup(this EndpointConfiguration config)
        {
            config.PurgeOnStartup(true);

            return(config);
        }
示例#49
0
 public SessionManagerClient(EndpointConfiguration endpointConfiguration) :
     base(SessionManagerClient.GetBindingForEndpoint(endpointConfiguration), SessionManagerClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
        public static EndpointConfiguration SetupHeartbeat(this EndpointConfiguration config)
        {
            config.SendHeartbeatTo("heartbeats");

            return(config);
        }
示例#51
0
 public SpectatorStreamingClient(EndpointConfiguration endpoints)
 {
     endpoint = endpoints.SpectatorEndpointUrl;
 }
 public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata)
 {
     configuration.UsePersistence <InMemoryPersistence>();
     return(Task.FromResult(0));
 }
示例#53
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.SqlServer.StoreAndForwardSender";
        const string letters = "ABCDEFGHIJKLMNOPQRSTUVXYZ";
        var          random  = new Random();
        var          endpointConfiguration = new EndpointConfiguration("Samples.SqlServer.StoreAndForwardSender");

        endpointConfiguration.SendFailedMessagesTo("error");
        endpointConfiguration.UsePersistence <InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();

        #region DelayedRetriesConfig

        var recoverability = endpointConfiguration.Recoverability();
        recoverability.Delayed(
            customizations: delayed =>
        {
            delayed.NumberOfRetries(100);
            delayed.TimeIncrease(TimeSpan.FromSeconds(10));
        });

        #endregion

        recoverability.Immediate(immediate => immediate.NumberOfRetries(0));

        #region SenderConfiguration

        var transport = endpointConfiguration.UseTransport <SqlServerTransport>();
        transport.EnableLegacyMultiInstanceMode(ConnectionProvider.GetConnecton);

        var pipeline = endpointConfiguration.Pipeline;
        pipeline.Register(
            stepId: "Forward",
            behavior: new ForwardBehavior(),
            description: "Forwards messages to destinations.");
        pipeline.Register("Store",
                          factoryMethod: builder =>
        {
            var localAddress = builder.Build <ReadOnlySettings>().LocalAddress();
            return(new SendThroughLocalQueueRoutingToDispatchConnector(localAddress));
        },
                          description: "Send messages through local endpoint.");

        #endregion

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        try
        {
            Console.WriteLine("Press enter to publish a message");
            Console.WriteLine("Press any key to exit");
            while (true)
            {
                var key = Console.ReadKey();
                Console.WriteLine();
                if (key.Key != ConsoleKey.Enter)
                {
                    break;
                }
                var orderId        = new string(Enumerable.Range(0, 4).Select(x => letters[random.Next(letters.Length)]).ToArray());
                var orderSubmitted = new OrderSubmitted
                {
                    OrderId = orderId,
                    Value   = random.Next(100)
                };
                await endpointInstance.Publish(orderSubmitted)
                .ConfigureAwait(false);

                Console.WriteLine($"Order {orderId} placed");
            }
        }
        finally
        {
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
    }
示例#54
0
    static async Task Main()
    {
        Console.Title = "Samples.MultiTenant.Receiver";

        var sharedDatabaseConfiguration = CreateBasicNHibernateConfig();

        var tenantDatabasesConfiguration = CreateBasicNHibernateConfig();
        var mapper = new ModelMapper();

        mapper.AddMapping <OrderMap>();
        tenantDatabasesConfiguration.AddMapping(mapper.CompileMappingForAllExplicitlyAddedEntities());

        var endpointConfiguration = new EndpointConfiguration("Samples.MultiTenant.Receiver");

        endpointConfiguration.LimitMessageProcessingConcurrencyTo(1);
        endpointConfiguration.SendFailedMessagesTo("error");
        var transport = endpointConfiguration.UseTransport <MsmqTransport>();
        var routing   = transport.Routing();

        routing.RegisterPublisher(
            eventType: typeof(OrderSubmitted),
            publisherEndpoint: "Samples.MultiTenant.Sender");

        #region ReceiverConfiguration

        var persistence = endpointConfiguration.UsePersistence <NHibernatePersistence>();
        persistence.UseConfiguration(tenantDatabasesConfiguration);
        persistence.UseSubscriptionStorageConfiguration(sharedDatabaseConfiguration);
        persistence.UseTimeoutStorageConfiguration(sharedDatabaseConfiguration);
        persistence.DisableSchemaUpdate();

        endpointConfiguration.EnableOutbox();

        var settings = endpointConfiguration.GetSettings();
        settings.Set("NHibernate.Timeouts.AutoUpdateSchema", true);
        settings.Set("NHibernate.Subscriptions.AutoUpdateSchema", true);

        #endregion

        ReplaceOpenSqlConnection(endpointConfiguration);

        RegisterPropagateTenantIdBehavior(endpointConfiguration);


        var startableEndpoint = await Endpoint.Create(endpointConfiguration)
                                .ConfigureAwait(false);

        #region CreateSchema

        CreateSchema(tenantDatabasesConfiguration, Connections.TenantA);
        CreateSchema(tenantDatabasesConfiguration, Connections.TenantB);

        #endregion

        var endpointInstance = await startableEndpoint.Start()
                               .ConfigureAwait(false);

        Console.WriteLine("Press any key to exit");
        Console.ReadKey();
        if (endpointInstance != null)
        {
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
    }
示例#55
0
 public SalaryTimeSpec_ServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
     base(SalaryTimeSpec_ServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
        static private STSConfiguration createValidStsConfigurationResponse()
        {
            EndpointConfiguration ec  = new EndpointConfiguration();
            List <Endpoint>       eps = new List <Endpoint>();

            Endpoint fed = new Endpoint();

            fed.AuthenticationSchemes      = AuthType.Anonymous;
            fed.CertificateValidation      = CertificateValidation.None;
            fed.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            fed.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.FederationMetadata);
            fed.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.FederationMetadata);
            fed.ServicePortType = PortType.HttpsPort;
            fed.PortType        = PortType.HttpsPort;
            fed.SupportsNtlm    = false;
            eps.Add(fed);

            Endpoint ls = new Endpoint();

            ls.AuthenticationSchemes      = AuthType.Anonymous;
            ls.CertificateValidation      = CertificateValidation.Device;
            ls.ClientCertificateQueryMode = ClientCertificateQueryMode.QueryAndRequire;
            ls.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Ls);
            ls.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Ls);
            ls.ServicePortType = PortType.HttpsPort;
            ls.PortType        = PortType.HttpsPort;
            ls.SupportsNtlm    = false;
            eps.Add(ls);

            Endpoint ls2 = new Endpoint();

            ls2.AuthenticationSchemes      = AuthType.Anonymous;
            ls2.CertificateValidation      = CertificateValidation.User;
            ls2.ClientCertificateQueryMode = ClientCertificateQueryMode.QueryAndRequire;
            ls2.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Ls);
            ls2.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Ls);
            ls2.ServicePortType = PortType.HttpsPortForUserTlsAuth;
            ls2.PortType        = PortType.HttpsPortForUserTlsAuth;
            ls2.SupportsNtlm    = false;
            eps.Add(ls2);

            Endpoint portal1 = new Endpoint();

            portal1.AuthenticationSchemes      = AuthType.Anonymous;
            portal1.CertificateValidation      = CertificateValidation.None;
            portal1.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            portal1.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Portal);
            portal1.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Portal);
            portal1.ServicePortType = PortType.HttpsPortForUserTlsAuth;
            portal1.PortType        = PortType.HttpsPortForUserTlsAuth;
            portal1.SupportsNtlm    = false;
            eps.Add(portal1);

            Endpoint oauth2token = new Endpoint();

            oauth2token.AuthenticationSchemes      = AuthType.Anonymous;
            oauth2token.CertificateValidation      = CertificateValidation.None;
            oauth2token.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            oauth2token.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.OAuth2Token);
            oauth2token.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.OAuth2Token);
            oauth2token.ServicePortType = PortType.HttpsPort;
            oauth2token.PortType        = PortType.HttpsPort;
            oauth2token.SupportsNtlm    = false;
            eps.Add(oauth2token);

            Endpoint oauth2auth = new Endpoint();

            oauth2auth.AuthenticationSchemes      = AuthType.Anonymous;
            oauth2auth.CertificateValidation      = CertificateValidation.Device;
            oauth2auth.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            oauth2auth.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.OAuth2Auth);
            oauth2auth.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.OAuth2Auth);
            oauth2auth.ServicePortType = PortType.HttpsPort;
            oauth2auth.PortType        = PortType.HttpsPort;
            oauth2auth.SupportsNtlm    = false;
            eps.Add(oauth2auth);


            Endpoint oauth2auth2 = new Endpoint();

            oauth2auth2.AuthenticationSchemes      = AuthType.Anonymous;
            oauth2auth2.CertificateValidation      = CertificateValidation.User;
            oauth2auth2.ClientCertificateQueryMode = ClientCertificateQueryMode.QueryAndRequire;
            oauth2auth2.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.OAuth2Auth);
            oauth2auth2.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.OAuth2Auth);
            oauth2auth2.ServicePortType = PortType.HttpsPortForUserTlsAuth;
            oauth2auth2.PortType        = PortType.HttpsPortForUserTlsAuth;
            oauth2auth2.SupportsNtlm    = false;
            eps.Add(oauth2auth2);

            Endpoint enroll = new Endpoint();

            enroll.AuthenticationSchemes      = AuthType.Anonymous;
            enroll.CertificateValidation      = CertificateValidation.None;
            enroll.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            enroll.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.EnrollmentServer);
            enroll.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.EnrollmentServer);
            enroll.ServicePortType = PortType.HttpsPort;
            enroll.PortType        = PortType.HttpsPort;
            enroll.SupportsNtlm    = false;
            eps.Add(enroll);

            Endpoint portal2 = new Endpoint();

            portal2.AuthenticationSchemes      = AuthType.Anonymous;
            portal2.CertificateValidation      = CertificateValidation.None;
            portal2.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            portal2.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Portal);
            portal2.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Portal);
            portal2.ServicePortType = PortType.HttpsPort;
            portal2.PortType        = PortType.HttpsPort;
            portal2.SupportsNtlm    = false;
            eps.Add(portal2);

            Endpoint winTrans = new Endpoint();

            winTrans.AuthenticationSchemes      = AuthType.Anonymous;
            winTrans.CertificateValidation      = CertificateValidation.None;
            winTrans.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            winTrans.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.WindowsTransportTrust2005);
            winTrans.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.WindowsTransportTrust2005);
            winTrans.ServicePortType = PortType.HttpsPort;
            winTrans.PortType        = PortType.HttpsPort;
            winTrans.SupportsNtlm    = false;
            eps.Add(winTrans);


            Endpoint cert2005 = new Endpoint();

            cert2005.AuthenticationSchemes      = AuthType.Anonymous;
            cert2005.CertificateValidation      = CertificateValidation.None;
            cert2005.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            cert2005.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.CertificateMixedTrust2005);
            cert2005.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.CertificateMixedTrust2005);
            cert2005.ServicePortType = PortType.HttpsPort;
            cert2005.PortType        = PortType.HttpsPort;
            cert2005.SupportsNtlm    = false;
            eps.Add(cert2005);


            Endpoint certTrans = new Endpoint();

            certTrans.AuthenticationSchemes      = AuthType.Anonymous;
            certTrans.CertificateValidation      = CertificateValidation.None;
            certTrans.ClientCertificateQueryMode = ClientCertificateQueryMode.QueryAndRequire;
            certTrans.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.CertificateTransportTrust2005);
            certTrans.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.CertificateTransportTrust2005);
            certTrans.ServicePortType = PortType.HttpsPortForUserTlsAuth;
            certTrans.PortType        = PortType.HttpsPortForUserTlsAuth;
            certTrans.SupportsNtlm    = false;
            eps.Add(certTrans);

            Endpoint user2005 = new Endpoint();

            user2005.AuthenticationSchemes      = AuthType.Anonymous;
            user2005.CertificateValidation      = CertificateValidation.None;
            user2005.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            user2005.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.UsernameMixedTrust2005);
            user2005.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.UsernameMixedTrust2005);
            user2005.ServicePortType = PortType.HttpsPort;
            user2005.PortType        = PortType.HttpsPort;
            user2005.SupportsNtlm    = false;
            eps.Add(user2005);

            Endpoint asym2005 = new Endpoint();

            asym2005.AuthenticationSchemes      = AuthType.Anonymous;
            asym2005.CertificateValidation      = CertificateValidation.None;
            asym2005.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            asym2005.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedAsymmetricBasic256Trust2005);
            asym2005.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedAsymmetricBasic256Trust2005);
            asym2005.ServicePortType = PortType.HttpsPort;
            asym2005.PortType        = PortType.HttpsPort;
            asym2005.SupportsNtlm    = false;
            eps.Add(asym2005);

            Endpoint sym2005 = new Endpoint();

            sym2005.AuthenticationSchemes      = AuthType.Anonymous;
            sym2005.CertificateValidation      = CertificateValidation.None;
            sym2005.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            sym2005.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedSymmetricBasic256Trust2005);
            sym2005.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedSymmetricBasic256Trust2005);
            sym2005.ServicePortType = PortType.HttpsPort;
            sym2005.PortType        = PortType.HttpsPort;
            sym2005.SupportsNtlm    = false;
            eps.Add(sym2005);

            Endpoint cert13 = new Endpoint();

            cert13.AuthenticationSchemes      = AuthType.Anonymous;
            cert13.CertificateValidation      = CertificateValidation.None;
            cert13.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            cert13.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.CertificateMixedTrust13);
            cert13.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.CertificateMixedTrust13);
            cert13.ServicePortType = PortType.HttpsPort;
            cert13.PortType        = PortType.HttpsPort;
            cert13.SupportsNtlm    = false;
            eps.Add(cert13);

            Endpoint user13 = new Endpoint();

            user13.AuthenticationSchemes      = AuthType.Anonymous;
            user13.CertificateValidation      = CertificateValidation.None;
            user13.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            user13.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.UsernameMixedTrust13);
            user13.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.UsernameMixedTrust13);
            user13.ServicePortType = PortType.HttpsPort;
            user13.PortType        = PortType.HttpsPort;
            user13.SupportsNtlm    = false;
            eps.Add(user13);

            Endpoint asym13 = new Endpoint();

            asym13.AuthenticationSchemes      = AuthType.Anonymous;
            asym13.CertificateValidation      = CertificateValidation.None;
            asym13.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            asym13.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedAsymmetricBasic256Trust13);
            asym13.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedAsymmetricBasic256Trust13);
            asym13.ServicePortType = PortType.HttpsPort;
            asym13.PortType        = PortType.HttpsPort;
            asym13.SupportsNtlm    = false;
            eps.Add(asym13);

            Endpoint sym13 = new Endpoint();

            sym13.AuthenticationSchemes      = AuthType.Anonymous;
            sym13.CertificateValidation      = CertificateValidation.None;
            sym13.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            sym13.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedSymmetricBasic256Trust13);
            sym13.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.IssuedTokenMixedSymmetricBasic256Trust13);
            sym13.ServicePortType = PortType.HttpsPort;
            sym13.PortType        = PortType.HttpsPort;
            sym13.SupportsNtlm    = false;
            eps.Add(sym13);

            Endpoint proxyMex = new Endpoint();

            proxyMex.AuthenticationSchemes      = AuthType.Anonymous;
            proxyMex.CertificateValidation      = CertificateValidation.None;
            proxyMex.ClientCertificateQueryMode = ClientCertificateQueryMode.None;
            proxyMex.Path            = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.Mex);
            proxyMex.ServicePath     = AdfsServicePathPairs.GetServicePath(AdfsServicePathPairs.PathKey.ProxyMex);
            proxyMex.ServicePortType = PortType.HttpsPort;
            proxyMex.PortType        = PortType.HttpsPort;
            proxyMex.SupportsNtlm    = false;
            eps.Add(proxyMex);

            ec.Endpoints = eps.ToArray();
            ServiceConfiguration sc = new ServiceConfiguration();

            sc.HttpPort  = 80;
            sc.HttpsPort = 443;
            sc.HttpsPortForUserTlsAuth       = 10000;
            sc.ProxyTrustCertificateLifetime = 21600;
            sc.ServiceHostName          = EnvironmentConfig.ADFSFamrDNSName;
            sc.CustomUpnSuffixes        = new string[0];
            sc.DeviceCertificateIssuers = new string[0];
            sc.DiscoveredUpnSuffixes    = new string[0];
            STSConfiguration sts = new STSConfiguration();

            sts.EndpointConfiguration = ec;
            sts.ServiceConfiguration  = sc;
            return(sts);
        }
示例#57
0
        public void Customize(EndpointConfiguration endpointConfiguration)
        {
            var persistence = endpointConfiguration.UsePersistence <AzureStoragePersistence>();

            persistence.ConnectionString("DefaultEndpointsProtocol=https;AccountName=[ACCOUNT];AccountKey=[KEY];");
        }
示例#58
0
    static async Task AsyncMain()
    {
        Console.Title = "Samples.MultipleDeserializers.ReceivingEndpoint";

        #region configAll

        var endpointConfiguration = new EndpointConfiguration("Samples.MultipleDeserializers.ReceivingEndpoint");

        // Xml
        endpointConfiguration.UseSerialization <XmlSerializer>();

        // External Newtonsoft Json
        var externalNewtonsoftJson = endpointConfiguration.AddDeserializer <NewtonsoftSerializer>();
        externalNewtonsoftJson.ContentTypeKey("NewtonsoftJson");

        // External Newtonsoft Bson
        var externalNewtonsoftBson = endpointConfiguration.AddDeserializer <NewtonsoftSerializer>();
        externalNewtonsoftBson.ReaderCreator(stream => new BsonReader(stream));
        externalNewtonsoftBson.WriterCreator(stream => new BsonWriter(stream));
        externalNewtonsoftBson.ContentTypeKey("NewtonsoftBson");

        // Jil
        var jil = endpointConfiguration.AddDeserializer <JilSerializer>();
        jil.ContentTypeKey("Jil");

        // Merged Newtonsoft
        endpointConfiguration.AddDeserializer <JsonSerializer>();

        // Message Pack
        endpointConfiguration.AddDeserializer <MessagePackSerializer>();

        // Wire
        endpointConfiguration.AddDeserializer <WireSerializer>();

        // register the mutator so the the message on the wire is written
        endpointConfiguration.RegisterComponents(
            registration: components =>
        {
            components.ConfigureComponent <IncomingMessageBodyWriter>(DependencyLifecycle.InstancePerCall);
        });

        #endregion

        endpointConfiguration.UsePersistence <InMemoryPersistence>();
        endpointConfiguration.EnableInstallers();
        endpointConfiguration.SendFailedMessagesTo("error");

        var endpointInstance = await Endpoint.Start(endpointConfiguration)
                               .ConfigureAwait(false);

        try
        {
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
        finally
        {
            await endpointInstance.Stop()
            .ConfigureAwait(false);
        }
    }
示例#59
0
 public MNBArfolyamServiceSoapClient(EndpointConfiguration endpointConfiguration) :
     base(MNBArfolyamServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), MNBArfolyamServiceSoapClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }
示例#60
0
 public SalaryTimeSpec_ServiceClient(EndpointConfiguration endpointConfiguration) :
     base(SalaryTimeSpec_ServiceClient.GetBindingForEndpoint(endpointConfiguration), SalaryTimeSpec_ServiceClient.GetEndpointAddress(endpointConfiguration))
 {
     this.Endpoint.Name = endpointConfiguration.ToString();
     ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
 }