The problem is not the length of the URL itself. Instead, it is related to OData functions, which lead to a very long URL segment. On Windows, this seems to be limited to 260 characters. So in my case, the URL segment MyFunction(ids='a,b,c,d,e,f')
is simply too long.
I found two different approaches:
- Change a Windows Registry setting (see here). I didn't test it, but the comments in the other thread look promising.
- Use Parameter Aliases.
I've chosen the second approach, so now my URL looks like this: http://localhost:5000/odata/MyFunction(ids=@p1)?@p1='a,b,c,d,e,f'
. The neat thing about this is that I hadn't to change anything in my OData configuration - it just works.
After a bit of testing, I reached the maximum query string length. I solved this by introducing a web.config
file with the following content:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxUrl="20100" maxQueryString="20000" />
</requestFiltering>
</security>
</system.webServer>
<system.web>
<httpRuntime maxUrlLength="20100" maxQueryStringLength="20000" />
</system.web>
</configuration>
The downside of the second approach is that Power BI Desktop doesn't seem to support this easily. I was not able to add a parameter alias within the simple UI when browsing an OData service. However, when creating a Power BI Parameter with the long query string, I was able to compose the OData URL with the Power BI Parameter als Parameter Alias on my own.