Flurl: Flurl + Blazor = Operation is not supported on this platform. System.Net.WebProxy.CreateDefaultProxy

I am trying to use Flurl on Blazor (WebAssembly), but it is giving this Exception:

Operation is not supported on this platform. System.Net.WebProxy.CreateDefaultProxy

Flurl.Http.FlurlHttpException: GET https://facilitatechfunctionapp.azurewebsites.net/api/PegaOcorrencias failed. Operation is not supported on this platform. —> System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Net.WebProxy.CreateDefaultProxy () <0x1a63c68 + 0x00004> in <0d9557faf41a43309918e509e43406d3>:0 at System.Net.Configuration.DefaultProxySectionInternal.GetSystemWebProxy () <0x1a63b20 + 0x00000> in <0d9557faf41a43309918e509e43406d3>:0 at System.Net.Configuration.DefaultProxySectionInternal.GetDefaultProxy_UsingOldMonoCode () <0x1a639e0 + 0x00000> in <0d9557faf41a43309918e509e43406d3>:0 at System.Net.Configuration.DefaultProxySectionInternal.GetSection () <0x1a63828 + 0x00022> in <0d9557faf41a43309918e509e43406d3>:0 at System.Net.WebRequest.get_InternalDefaultWebProxy () <0x1a63500 + 0x0002c> in <0d9557faf41a43309918e509e43406d3>:0 at System.Net.HttpWebRequest…ctor (System.Uri uri) <0x1a56f70 + 0x000c4> in <0d9557faf41a43309918e509e43406d3>:0 at System.Net.Http.HttpClientHandler.CreateWebRequest (System.Net.Http.HttpRequestMessage request) <0x1a566c8 + 0x00016> in <c65c24c9b8ae4fa0a6f2a7f04ff0f808>:0 at System.Net.Http.HttpClientHandler+<SendAsync>d__64.MoveNext () <0x1a5c688 + 0x00076> in <c65c24c9b8ae4fa0a6f2a7f04ff0f808>:0 — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x1a69770 + 0x00082> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1a68f88 + 0x00066> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1a148e0 + 0x00018> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x1a68d48 + 0x0000c> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Net.Http.HttpClient+<SendAsyncWorker>d__47.MoveNext () <0x1a36920 + 0x0017e> in <c65c24c9b8ae4fa0a6f2a7f04ff0f808>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x1a69770 + 0x00082> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1a68f88 + 0x00066> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1a148e0 + 0x00018> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x1a68d48 + 0x0000c> in <c3d30d6b444c49a099513b1626f0c805>:0 at Flurl.Http.FlurlRequest+<SendAsync>d__19.MoveNext () <0x19ddf08 + 0x0045a> in <23b15cc5746a4a3e9d61badfb08f5a54>:0 — End of inner exception stack trace — at Flurl.Http.FlurlRequest+<SendAsync>d__19.MoveNext () <0x19ddf08 + 0x007ec> in <23b15cc5746a4a3e9d61badfb08f5a54>:0 — End of stack trace from previous location where exception was thrown — at Flurl.Http.FlurlRequest+<SendAsync>d__19.MoveNext () <0x19ddf08 + 0x00992> in <23b15cc5746a4a3e9d61badfb08f5a54>:0 — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x1a69770 + 0x00082> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1a68f88 + 0x00066> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1a148e0 + 0x00018> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () <0x1a68d48 + 0x0000c> in <c3d30d6b444c49a099513b1626f0c805>:0 at Flurl.Http.HttpResponseMessageExtensions+<ReceiveJson>d__01[T].MoveNext () <0x1a727c8 + 0x000d4> in <23b15cc5746a4a3e9d61badfb08f5a54>:0 — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) <0x1a69770 + 0x00082> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) <0x1a68f88 + 0x00066> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) <0x1a148e0 + 0x00018> in <c3d30d6b444c49a099513b1626f0c805>:0 at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () <0x1a79c20 + 0x0000c> in <c3d30d6b444c49a099513b1626f0c805>:0 at BlazorWebApplication1.Pages.Counter+<IncrementCount>d__3.MoveNext () <0x19a2f30 + 0x000f0> in <ed76a363f661408babbed8b68cf14afe>:0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 20 (10 by maintainers)

Most upvoted comments

2.1 is now RTM.

@tmenier I have posted the question on Stack Overflow, see here: https://stackoverflow.com/questions/52522004/blazor-0-6-0-wipes-flurl-compatibility Maybe you can answer it there? Thanks a lot.

@TonyHenrique I guess the good news is that this is the first confirmation I’ve seen that at least a basic Flurl HTTP call works fine on .NET Core 2.1. Thanks for confirming that.

Of course that doesn’t help you get past your issue with Blazor, but it does point to this being a Blazor/HttpClient issue. This issue seems to indicate that you might need to use an HttpClient with a BrowserHttpMessageHandler. You can get that working in Flurl with a custom HttpClientFactory (of the Flurl variety, not .NET Core 2.1’s). But also watch out for potential Json.NET errors - Flurl uses that too.

I’m going to close this since it seems pretty clear this isn’t a Flurl issue. Good luck, and if you run into more issues with Blazor/HttpClient, I’d open an issue on Blazor’s repo.

I’m not very familiar with Blazor but I took a quick look at the readme and I think I found the problem:

To get setup with Blazor:

  1. Install the .NET Core 2.1 Preview 1 SDK.

I suspect the Core 2.1 Preview is not compatible with Flurl.