Does not work on netcoreapp2.1
Opened this issue · 5 comments
Hello,
I'm trying to implement a simple app to read values from consul.KV
.
I've made an example app in F# using you library. Code is here: https://github.com/MortalFlesh/fsharp-consul
It works fine, when I'm using netcoreapp2.0
.
Get value for "some/key" ...
Key: some/key | Value: "some value"
I have a private instance of consul, so I can't give you live example data..
But when I change netcoreapp2.0
to netcoreapp2.1
it does not work..
Get value for "some/key" ...
Key: some/key | Value: "<null-response>"
<null-response>
is a fallback when client.KV.Get(key).Result.Response
is null
code is here https://github.com/MortalFlesh/fsharp-consul/blob/master/Program.fs#L18
I'm running the code on Mac OS High Sierra 10.13.6
with
dotnet --version
2.1.302
I have a problem with client.KV.List()
as well, but I wanted to simplify this as much as possible.
Do you know what might be the problem? Am I doing something wrong?
Thanks for you reply.
Hey, I'm also using net core 2.1 and C# and it seems to be working as expected for me
using (var client = new ConsulClient(opt => { opt.Address = new Uri("http://localhost:32822");}))
{
var result = await client.KV.Get("database/connectionstrings/
}
Im not sure about F# never used, but i know it does work on .net core 2.1, sorry i couldnt be of more assitance
I have same problem in C# as well ..
using (var client = new ConsulClient(opt => { opt.Address = new Uri("...consul-url...");}))
{
var result = client.KV.List("config");
Console.WriteLine("Result: " + result.Result.StatusCode);
Console.WriteLine("Result: " + result.Result.Response);
}
ends up with
2.0
Result: OK
Result: Consul.KVPair[]
2.1
Result: NotFound
Result:
The code, url, prefix and everything is same I just change from <TargetFramework>netcoreapp2.0</TargetFramework>
to <TargetFramework>netcoreapp2.1</TargetFramework>
.
So @johnfg10 are you really sure that it works for you? Because I have some result but there is an invalid response in it.
Mayby try using client.KV.get()
It doesn't really matter which method I use. Both of them works fine on 2.0
- List returns all Pairs with prefix and Get returns a single Pair - but both of them returns a Not found
response on 2.1
.
Ok so I've tested further it 100% works for me maybe its a mac issue because of this code:
public async void test()
{
Console.WriteLine("test start");
using (var client = new ConsulClient(opt => { opt.Address = new Uri("http://localhost:8500");}))
{
var result = await client.KV.List("test");
foreach (var kvPair in result.Response)
{
Console.WriteLine(kvPair.Key);
Console.WriteLine(Encoding.UTF8.GetString(kvPair.Value));
}
}
Console.WriteLine("test end");
}
prints this in console
test start
test/one
test one
test/two
test two
test end
which is the values in my consul key store.
You can also see here that the version is definitely 2.1
I have attached the test app I made so you can test, but I know 100% it's working for me on windows
testapp1.zip