Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid URI: The hostname could not be parsed. #210

Closed
spyguyhi opened this issue Apr 7, 2017 · 8 comments
Closed

Invalid URI: The hostname could not be parsed. #210

spyguyhi opened this issue Apr 7, 2017 · 8 comments

Comments

@spyguyhi
Copy link

spyguyhi commented Apr 7, 2017

I am getting this error when calling mailchimpManager.List.GetAllAsync() and this is the stacktrace:

at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at MailChimp.Net.Core.BaseLogic.CreateMailClient(String resource)
at MailChimp.Net.Logic.ListLogic.d__4.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 System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at MailChimp.Net.Logic.ListLogic.d__3.MoveNext()

Anyone have an idea of what I might be doing wrong? I have never come across this error and Google searching hasn't turned up anything useful.

@shadowsok
Copy link

shadowsok commented Apr 18, 2017

I had the same issue I solved by setting the app key after the instantiating call.

MC = new MailChimpManager();
MC.Configure(new MailChimpConfiguration{ApiKey = apkey});

@spyguyhi
Copy link
Author

spyguyhi commented Apr 28, 2017

Hmmm, I attempted your fix but I still got the same error. Here's the code before:

MailChimp.Net.MailChimpManager mcUHFManager = new MailChimp.Net.MailChimpManager(mcUHFAPIKey);
mcUHFManager.Configure(new MailChimp.Net.MailChimpConfiguration { Limit = 100 });
MailChimp.Net.MailChimpManager mcAGManager = new MailChimp.Net.MailChimpManager(mcAGAPIKey);
mcAGManager.Configure(new MailChimp.Net.MailChimpConfiguration { Limit = 100 });

try
{
	viewModel.mailChimpLists = mcUHFManager.Lists.GetAllAsync().Result;
}
catch (Exception excep)
{
	throw;
}

and here's the code after your fix:

MailChimp.Net.MailChimpManager mcUHFManager = new MailChimp.Net.MailChimpManager();
mcUHFManager.Configure(new MailChimp.Net.MailChimpConfiguration { ApiKey = mcUHFAPIKey });
mcUHFManager.Configure(new MailChimp.Net.MailChimpConfiguration { Limit = 100 });
MailChimp.Net.MailChimpManager mcAGManager = new MailChimp.Net.MailChimpManager();
mcAGManager.Configure(new MailChimp.Net.MailChimpConfiguration { ApiKey = mcAGAPIKey });
mcAGManager.Configure(new MailChimp.Net.MailChimpConfiguration { Limit = 100 });

try
{
	viewModel.mailChimpLists = mcUHFManager.Lists.GetAllAsync().Result;
}
catch (Exception excep)
{
	throw;
}

both ways are caught in the try/catch with the same Invalid URI error.

@WoodsonJ
Copy link

Also having trouble with this, any further clarification would be super helpful.

Thanks!

@brandonseydel
Copy link
Owner

Please check in your branch into your public repos so we can help.

@spyguyhi
Copy link
Author

Branch? I haven't changed your code at all but rather added your api through nuget in our application.

@spyguyhi
Copy link
Author

Latest news. We were finally able to obtain VS 2017 where previously we used VS2013 so weren't able to compile the wrapper project. I then removed the wrapper reference installed through Nuget and compiled and manually added the wrappers dll. I no longer get this error. I don't know if its because I downloaded the code September last year or if it is because our project is now able run the newer C# code.

@brandonseydel
Copy link
Owner

It is because you are reconfiguring mailchimp please provide the limit and API key in the same instance of MailChimpConfiguration

@github-actions
Copy link

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants