Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Redis connector doesn't use hostnames on Mac or Linux #4

Closed
autodidaddict opened this issue Jan 17, 2017 · 6 comments
Closed

Redis connector doesn't use hostnames on Mac or Linux #4

autodidaddict opened this issue Jan 17, 2017 · 6 comments

Comments

@autodidaddict
Copy link

autodidaddict commented Jan 17, 2017

Error Message:
 System.Exception : Could not resolve a service of type '(my class)' for the parameter 'eventProcessor' of method 'Configure' on type '(my startup)'.
---- System.AggregateException : One or more errors occurred. (**This platform does not support connecting sockets to DNS endpoints via the instance Connect and ConnectAsync methods, due to the potential for a host name to map to multiple IP addresses and sockets becoming invalid for use after a failed connect attempt. Use the static ConnectAsync method, or provide to the instance methods the specific IPAddress desired.**)
-------- System.PlatformNotSupportedException : This platform does not support connecting sockets to DNS endpoints via the instance Connect and ConnectAsync methods, due to the potential for a host name to map to multiple IP addresses and sockets becoming invalid for use after a failed connect attempt. Use the static ConnectAsync method, or provide to the instance methods the specific IPAddress desired.

This error comes up when you provide a hostname like localhost or a fully-qualified hostname pointing at a cloud-based installation of redis (for example, the one you get when you use Pivotal Web Services hosting). In other words, if my service binding gives me an IP address, then I'm fine on Linux/Mac, but if my service binding gives me a host name, then I'm screwed and when I take my windows-running app from my developer workstation and push it to my linux cell in PCF, then I'm in for an ugly surprise when I try and start the app.

@autodidaddict autodidaddict changed the title Redis connector doesn't work on Mac or Linux Redis connector doesn't use hostnames on Mac or Linux Jan 17, 2017
@dtillman
Copy link
Contributor

dtillman commented Feb 3, 2017

Kevin,
Ya... this is a known problem in .NET Core.. and the Stackexchange guys are struggling with ...
StackExchange/StackExchange.Redis#410 ...

Let me check the latest on this and see if it got fixed in .NET Core or a work around was put in place by the stackexchange guys.

Dave

@dtillman
Copy link
Contributor

dtillman commented Feb 3, 2017

Looks like a work around from stack exchange is in the works .. also seems that setting "resolveDns= true" in your appsettings.json might also work around the issue. My testing on my Mac showed that if I set "host=myMacsHostName" and set "resolveDns=true" .. the the.NET Core exception goes away.

For some reason setting "host=localhost" still failed,
Dave

@tillig
Copy link

tillig commented Aug 8, 2017

Possibly helpful to future readers: I got the This platform does not support connecting sockets to DNS endpoints exception on a Linux cell when my Redis service broker started giving me strong passwords that have commas in them. Something to look for. #10

@DreamingDevs
Copy link

@dtillman Your post solved my problem. thank you.

@mhoran
Copy link

mhoran commented Sep 13, 2017

Adding the follwing to appsettings.json resolved this for me, using Steeltoe Connectors and Cloud Foundry:

{
  "redis": {
    "client": {
      "resolveDns": true
    }
  }
}

@TimHess
Copy link
Member

TimHess commented Oct 9, 2018

This appears to be resolved

@TimHess TimHess closed this as completed Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants