SoCreate / service-fabric-distributed-cache

MIT License
36 stars 19 forks source link

Getting "System.Fabric.FabricServiceNotFoundException: Service does not exist." on SetAsync #20

Closed ledpup closed 3 years ago

ledpup commented 3 years ago

I'm trying to set the cache for a key. I think the basic code is there and working. When I run it without a CacheStoreServiceUri I get the following error.

Cache store not found in Service Fabric cluster. Try setting the 'CacheStoreServiceUri' configuration option to the location of your cache store.

When I set the CacheStoreServiceUri, I get the following error.

System.Fabric.FabricServiceNotFoundException: Service does not exist.

I think the problem is: I don't know what the CacheStoreServiceUri is supposed to be set to. The documentation says:

Used to explicitly point to the Stateful Reliable Service that is the cache store. If not supplied the client will try to auto discover the cache store.

The sample code has it as "fabric:/ServiceFabricDistributedCache/DistributedCacheStore". I took that and guessed what my URI might be. I don't think I guessed correctly.

Anyone got a suggestion on how to do this?

lurock commented 3 years ago

It sounds like you need to setup the Cache Store. Start by creating a .NET Core Stateful Service. Follow the instructions on this page https://service-fabric-distributed-cache.socreate.it/docs/set-up/how-to-set-up. The service that you create in this step will be the service URI you will use when you create your client app that is using the IDistributedCache.

ledpup commented 3 years ago

Hi @lurock, you're correct. I hadn't inherited from DistributedCacheStoreService in the correct class. I have another issue now, but this one is closed.