private static ChannelFactory <T> CreateServiceBusClientChannelFactory <T>(string serviceNamespace, string servicePath, string issuerName, string issuerSecret, Binding binding) { Guard.ArgumentNotNullOrEmptyString(serviceNamespace, "serviceNamespace"); Guard.ArgumentNotNullOrEmptyString(servicePath, "servicePath"); Guard.ArgumentNotNullOrEmptyString(issuerName, "issuerName"); Guard.ArgumentNotNullOrEmptyString(issuerSecret, "issuerSecret"); Guard.ArgumentNotNull(binding, "binding"); var callToken = TraceManager.DebugComponent.TraceIn(serviceNamespace, servicePath, binding.Name); var address = ServiceBusEnvironment.CreateServiceUri(WellKnownProtocolScheme.ServiceBus, serviceNamespace, servicePath); var credentialsBehaviour = new TransportClientEndpointBehavior(); credentialsBehaviour.CredentialType = TransportClientCredentialType.SharedSecret; credentialsBehaviour.Credentials.SharedSecret.IssuerName = issuerName; credentialsBehaviour.Credentials.SharedSecret.IssuerSecret = issuerSecret; var endpoint = new ServiceEndpoint(ContractDescription.GetContract(typeof(T)), binding, new EndpointAddress(address)); endpoint.Behaviors.Add(credentialsBehaviour); // Apply default endpoint configuration. ServiceEndpointConfiguration.ConfigureDefaults(endpoint); ChannelFactory <T> clientChannelFactory = new ChannelFactory <T>(endpoint); TraceManager.DebugComponent.TraceOut(callToken, endpoint.Address.Uri); return(clientChannelFactory); }
public ServiceEndpointConfiguration GetServiceEndpointConfiguration(string name) { var s = new ServiceEndpointConfiguration(); s.Name = name; EndpointConfiguration e = GetEndpointConfiguration(name); s.Address = new EndpointAddress(e.Address); s.Binding = GetConfiguredHttpBinding(e).CreateBinding(); return(s); }
private static ServiceHost CreateServiceBusHost(string serviceNamespace, string servicePath, string issuerName, string issuerSecret, Binding binding, Type serviceType) { Guard.ArgumentNotNullOrEmptyString(serviceNamespace, "serviceNamespace"); Guard.ArgumentNotNullOrEmptyString(servicePath, "servicePath"); Guard.ArgumentNotNullOrEmptyString(issuerName, "issuerName"); Guard.ArgumentNotNullOrEmptyString(issuerSecret, "issuerSecret"); Guard.ArgumentNotNull(binding, "binding"); var callToken = TraceManager.DebugComponent.TraceIn(serviceNamespace, servicePath, binding.Name); var address = ServiceBusEnvironment.CreateServiceUri(WellKnownProtocolScheme.ServiceBus, serviceNamespace, servicePath); var credentialsBehaviour = new TransportClientEndpointBehavior(); credentialsBehaviour.CredentialType = TransportClientCredentialType.SharedSecret; credentialsBehaviour.Credentials.SharedSecret.IssuerName = issuerName; credentialsBehaviour.Credentials.SharedSecret.IssuerSecret = issuerSecret; var endpoint = new ServiceEndpoint(ContractDescription.GetContract(GetServiceContract(serviceType)), binding, new EndpointAddress(address)); endpoint.Behaviors.Add(credentialsBehaviour); // Apply default endpoint configuration. ServiceEndpointConfiguration.ConfigureDefaults(endpoint); ServiceBehaviorAttribute serviceBehaviorAttr = FrameworkUtility.GetDeclarativeAttribute <ServiceBehaviorAttribute>(serviceType); ServiceHost host = null; if (serviceBehaviorAttr != null && serviceBehaviorAttr.InstanceContextMode == InstanceContextMode.Single) { host = new ServiceHost(Activator.CreateInstance(serviceType)); } else { host = new ServiceHost(serviceType); } host.Description.Endpoints.Add(endpoint); #if DEBUG var debugBehavior = new ServiceDebugBehavior(); debugBehavior.IncludeExceptionDetailInFaults = true; host.Description.Behaviors.Remove <ServiceDebugBehavior>(); host.Description.Behaviors.Add(debugBehavior); #endif TraceManager.DebugComponent.TraceOut(callToken, endpoint.Address.Uri); return(host); }
private static void InitializeHangfire(IAppBuilder app) { // Initializing the Hangfire scheduler var standardKernel = new KernelBuilder().ForHangFire().Build(); GlobalConfiguration.Configuration.UseNinjectActivator(standardKernel); GlobalConfiguration.Configuration.UseSqlServerStorage("kitos_HangfireDB"); GlobalJobFilters.Filters.Add(new AdvisSendFailureFilter(standardKernel)); GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute { Attempts = KitosConstants.MaxHangfireRetries }); app.UseHangfireDashboard(); app.UseHangfireServer(new KeepReadModelsInSyncProcess()); ServiceEndpointConfiguration.ConfigureValidationOfOutgoingConnections(); var recurringJobManager = new RecurringJobManager(); recurringJobManager.AddOrUpdate( recurringJobId: StandardJobIds.CheckExternalLinks, job: Job.FromExpression((IBackgroundJobLauncher launcher) => launcher.LaunchLinkCheckAsync(CancellationToken.None)), cronExpression: Cron.Weekly(DayOfWeek.Sunday, 0), timeZone: TimeZoneInfo.Local); new RecurringJobManager().AddOrUpdate( recurringJobId: StandardJobIds.RebuildDataProcessingReadModels, job: Job.FromExpression((IBackgroundJobLauncher launcher) => launcher.LaunchFullReadModelRebuild(ReadModelRebuildScope.DataProcessingRegistration, CancellationToken.None)), cronExpression: Cron.Never(), //On demand timeZone: TimeZoneInfo.Local); new RecurringJobManager().AddOrUpdate( recurringJobId: StandardJobIds.RebuildItSystemUsageReadModels, job: Job.FromExpression((IBackgroundJobLauncher launcher) => launcher.LaunchFullReadModelRebuild(ReadModelRebuildScope.ItSystemUsage, CancellationToken.None)), cronExpression: Cron.Never(), //On demand timeZone: TimeZoneInfo.Local); }
public ServiceEndpointConfiguration GetServiceEndpointConfiguration (string name) { var s = new ServiceEndpointConfiguration (); s.Name = name; EndpointConfiguration e = GetEndpointConfiguration (name); s.Address = new EndpointAddress (e.Address); s.Binding = GetConfiguredHttpBinding (e).CreateBinding (); return s; }
/// <summary> /// Notifies this extension component that it has been registered in the owner's collection of extensions. /// </summary> /// <param name="owner">The extensible owner object that aggregates this extension.</param> public void Attach(IExtensibleCloudServiceComponent owner) { this.discoveryClientRegistration = ServiceEndpointConfiguration.RegisterDiscoveryClient(this); }
public EndpointValidationServiceTest() { ServiceEndpointConfiguration.ConfigureValidationOfOutgoingConnections(); }