Select to view content in your preferred language

Issue with Loading WMSLayer in .NET MAUI Application: Misused Header Name 'Content-Encoding'

874
7
06-27-2024 02:19 AM
Labels (3)
MaxPower
Emerging Contributor

Hello,

I am experiencing an issue while trying to load a WMS layer in my .NET MAUI application using the ArcGIS Runtime SDK. The WMS layer works fine on iOS, but on Android and WinUI, I encounter the following error:

Misused header name, 'Content-Encoding'. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.

 

Here is the code snippet I am using to load the WMS layer:

private async Task<WmsLayer> GetWMSLayer(WMS wMS)
{
try
{
WmsLayer myWmsLayer = new(new Uri(wMS.url), new List<string> { wMS.layername });

await myWmsLayer.LoadAsync();
return myWmsLayer;
}
catch (Exception ex)
{
await Application.Current.MainPage.DisplayAlert("Error", ex.ToString(), "OK");
}
return null;
}

 

The WMS layer URL is: https://geo4.service24.rlp.de/wms/rp_dop40.fcgi

Layer name: rp_dop40

I have ensured that all NuGet packages are up to date. However, the issue persists. Any guidance on resolving this issue would be greatly appreciated.

Thank you in advance for your assistance!

0 Kudos
7 Replies
dotMorten_esri
Esri Notable Contributor

Looks like this server is returning "Content-Encoding" in the Vary header which is causing some issues for our caching. I've logged an internal bug to fix this and just ignore invalid values.

MaxPower
Emerging Contributor

Thank you for your prompt response and for identifying the issue with the "Content-Encoding" in the Vary header. I appreciate that you've logged an internal bug to address this problem.

0 Kudos
dotMorten_esri
Esri Notable Contributor

Fix was just merged and should be in v200.5

PreetiMaske
Esri Regular Contributor

Good news!  ArcGIS Maps SDK version 200.5.0 was just released today and issue is fixed with this release.

Thank you for bringing this one to our attention!

0 Kudos
MaxPower
Emerging Contributor

Thank you for the update! I’ve updated to ArcGIS Maps SDK version 200.5.0 and tested the WMS layer again. Unfortunately, I’m still encountering the same error:

 

"Misused header name, 'Content-Encoding'. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects."

 

Could you confirm if this fix was specifically tested with the WMS layer I’m using (URL: https://geo4.service24.rlp.de/wms/rp_dop40.fcgi, Layer name: rp_dop40)? If there’s any additional troubleshooting or configurations I should try, please let me know.

Thanks again for your continued support!

0 Kudos
dotMorten_esri
Esri Notable Contributor

I just retried the repro on 200.4, then upgraded to 200.5 on Maui WinUI and observed the problem go away. Could you try doing a full clean and forced rebuild, to make sure no old 200.4 assemblies are left around?

 

dotMorten_esri_0-1724783132687.png

 

0 Kudos
MaxPower
Emerging Contributor

Thank you for your continued support. After further testing, we noticed an additional issue with the WMS layer (https://geo4.service24.rlp.de/wms/rp_dop40.fcgi, Layer name: rp_dop40):

Initially, the WMS layer loads and displays on the map without any issues. However, if we replace it with a different WMS layer (such as OSM) and then attempt to reload the rp_dop40 WMS layer, the same "Misused header name, 'Content-Encoding'" error reappears.

It seems that the issue may persist specifically when reloading or switching back to this WMS layer. Is there any additional insight or workaround for handling this scenario?

Thank you for your assistance!

0 Kudos