I have an Asp.net Core 2.0 stateless Service and an Asp.net Core 2.0 stateful service on Service Fabric 6 with 10 partition count.
I followed this tutorial
https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-add-a-web-frontend
I followed all steps except that I used the templates in Visual Studio where CreateServiceReplicaListeners is using KestrelCommunicationListener
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
return new ServiceReplicaListener[]
{
new ServiceReplicaListener(serviceContext =>
new KestrelCommunicationListener(serviceContext, (url, listener) =>
{
return new WebHostBuilder()
.UseKestrel()
.ConfigureServices(
services => services
.AddSingleton<StatefulServiceContext>(serviceContext)
.AddSingleton<IReliableStateManager>(this.StateManager))
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.UseUniqueServiceUrl)
.UseUrls(url)
.Build();
}))
};
}
When I call my service in the Asp.net Core 2.0 Stateless service using this code:
var service = ServiceProxy.Create<IStorageService>(new Uri("fabric:/MyCluster/Storage"), new ServicePartitionKey(Fnv1aHashCode.Get64bitHashCode(User.Id)));
await service.MyMethod();
An Exception is raised when calling "MyMethod"
Client is trying to connect to invalid address http://localhost:58352/etc..
The url present in the exception is present in the Service Fabric Explorer, and the Port and PartitionKey is correct. No Endpoints are set in the ServiceManifest, since the Stateful service is basically just the template with the addition of an IService Interface and the MyMethod method as per tutorial above.
What I'm missing here? The documentation is not up to date for Asp.net Core 2.0.
I tried to not use partitions, setting ServicePartitionKey(0)
but same result.
I don't know how to proceed.