question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parameter limit: System.UriFormatException: Invalid URI: The Uri string is too long

See original GitHub issue

Using .net 5

I’m using SolrQueryInList and needing to add many items, up to 1000. Currently it only lets me get to about 350 before blowing up with “Uri string too long”

After googling I found that I might need to make sure my connection to solr is a “post” instead of a “get”? If this is the cause, how do I go about doing that in my startup?

currently I have:

            services.AddSolrNet<DynamicSolrItem>(SolrUrl, options =>
            {
                options.HttpClient.DefaultRequestHeaders.Authorization =
                    new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentialsBase64);
            });

What’s the correct way to make it do a post?

Also, if I use “Query” instead of “QueryAsync” I see that it is trying to use a “Post Connection”. But unfortunitly that also blows up with a 401 error. Any thoughts?

UPDATE: https://github.com/SolrNet/SolrNet/issues/524

Using the code from this issue I am now able to run the “Query” with my credentials, which in turn I am able to pass more parameters. From my research the only reason I’m able to pass more parameters is because “Query” reverts back to an old way of connecting that uses “POST” by default. This seems convoluted so I’m still wondering if there is a more “correct” way to get my normal QueryAsync stuff to call solr via POST.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mauschcommented, Feb 28, 2022

Is there a nuget that gets created when you merge to master branch?

Yep see https://github.com/orgs/SolrNet/packages

1reaction
mauschcommented, Feb 21, 2022

This recent fix should address your problem https://github.com/SolrNet/SolrNet/pull/583

Read more comments on GitHub >

github_iconTop Results From Across the Web

HttpClient: The uri string is too long
I receive this rediculous error. {System.UriFormatException: Invalid URI: The Uri string is too long. at System.UriHelper.EscapeString at ...
Read more >
Error : HTTP Request: Invalid URI: The Uri string is too long
When I try to download the image using the url in HTTP request, getting this error,. HTTP Request: Invalid URI: The Uri string...
Read more >
Invalid URI: The Uri string is too long.
With smaller file works all fine, but with a bit bigger file i get "Invalid URI: The Uri string is too long."
Read more >
SSRS report - Invalid URI: The Uri string is too long.
I get the above error that can be found in the report log. Is there a limitation for a size of a single...
Read more >
SSRS 2012 Error: Invalid URI: The Uri string is too long
"Invalid URI: The Uri string is too long" means that your address is probably over 2,000 characters long! This suggests to me that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found