Birden çok bağlantı noktasını dinlemek için bir hizmet kumaşı uygulaması bağlamak mümkün mü?Service-Fabric Birden çok son noktaya bağlama
Temel olarak, http: 80 ve https: 443 dinleyen ve http isteklerini https'ye yönlendiren bir kamu hizmetine sahip olmaya çalışıyorum.
Yeni bir ASP.net Core hizmeti oluşturdum, tek tek gayet iyi çalışıyor. Yani SSL 443 veya sadece SSL olmayan 80 ile, ancak ServiceInstanceListeners
her ikisini de eklediğimde başarısız oluyor! - öylesine görünüyor hem dinleyiciler farklı adlara sahip olduğundan garip
Unhealthy event: SourceId='System.RA', Property='ReplicaOpenStatus', HealthState='Warning', ConsiderWarningAsError=false.
Replica had multiple failures in API call: IStatelessServiceInstance.Open(); Error = System.Fabric.FabricElementAlreadyExistsException (-2146233088)
Unique Name must be specified for each listener when multiple communication listeners are used
at Microsoft.ServiceFabric.Services.Communication.ServiceEndpointCollection.AddEndpointCallerHoldsLock(String listenerName, String endpointAddress)
at Microsoft.ServiceFabric.Services.Communication.ServiceEndpointCollection.AddEndpoint(String listenerName, String endpointAddress)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__0.MoveNext()
:
Servis Kumaş Explorer birkaç kez zaman aşımına uğradıktan sonra aşağıdaki hatayı söylüyor. Kaçırdığım dinleyici adını koymam gereken bir yer var mı?
Bunun için Asp.net Core şablonunu kullanıyorum. şöyle My Vatansız Servis kodudur:
internal sealed class Web : StatelessService
{
public Web(StatelessServiceContext context)
: base(context)
{ }
/// <summary>
/// Optional override to create listeners (like tcp, http) for this service instance.
/// </summary>
/// <returns>The collection of listeners.</returns>
protected override IEnumerable<ServiceInstanceListener> CreateServiceInstanceListeners()
{
return new ServiceInstanceListener[]
{
new ServiceInstanceListener(serviceContext =>
new WebListenerCommunicationListener(serviceContext, "ServiceEndpointHttps", url =>
{
ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting WebListener on {url}");
return new WebHostBuilder()
.UseWebListener()
.ConfigureServices(
services => services
.AddSingleton<StatelessServiceContext>(serviceContext))
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseUrls(url)
.Build();
})),
new ServiceInstanceListener(serviceContext =>
new WebListenerCommunicationListener(serviceContext, "ServiceEndpointHttp", url =>
{
ServiceEventSource.Current.ServiceMessage(serviceContext, $"Starting WebListener on {url}");
return new WebHostBuilder()
.UseWebListener()
.ConfigureServices(
services => services
.AddSingleton<StatelessServiceContext>(serviceContext))
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseUrls(url)
.Build();
}))
};
}
}
Bu ad hizmetiniz için ayarlarınızdaki bitiş noktasının adıyla eşleşmelidir. Tek bir uç noktaya sahip bir servis için boş bırakmanız yeterlidir, ancak birden fazla alana sahip olduğunuzda bunları isimle tanımlamanız gerekir. – yoape
Bilmekte fayda var, teşekkürler! Gelecekte beni rahatsız etmeyecek. – Mardoxx