Blazor client-side and WCF
Asked Answered
D

4

5

I'm trying to use client-side Blazor to display some data, provided by existing WCF service. I was able to add a connected service reference, the proxy is generated. But when I'm trying to invoke it like this:

var client = new SoftConServiceClient();
await client.PingAsync(new PingRequest());

there is a bunch of errors, related to MonoTouch. By digging into the code of Mono, there is an explicit NotImplementedException in the constructor of the System.ServiceModel.DnsEndpointIdentity.

Am I right to assume that there is no way now to call legacy WCF service from Blazor client-side? If that's not the case, can anyone share a guide about how to properly do it?

Bonus question: if that is not possible, what would be the best option to approach this? Modify WCF to become REST-ish or just drop it and implement .net core api service?

Thanks a lot in advance!

Dorsal answered 22/7, 2019 at 12:43 Comment(0)
C
6

Core does not support WCF very well instead of not at all. Especially in terms of authentication and security, such as the service created by using WS* binding. But for services created by using BasicHttpBinding or Restful styles services. We could invoke them normally on Core-based clients, whether using client proxy class or Channel Factory. Please refer to below official repository.
https://github.com/dotnet/wcf
I suggest you re-construct your server project with BasicHttpBinding or using Asp.net WebAPI to create the backend service.
https://learn.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
Feel free to let me know if there is anything I can help with.

Carpous answered 23/7, 2019 at 2:16 Comment(0)
I
4

WCF is not supported in .NET Core out of the box, however there seems like there is a community project that is working on adding support for it in .NET Core

https://github.com/CoreWCF/CoreWCF

See What replaces WCF in .Net Core? for more info.

Islean answered 22/7, 2019 at 13:8 Comment(0)
Q
2

I was able to to put WCF 4.7.2 using techniques found with SoftCore in .Net 5. I can also work SoftCore Hosted Example Blazor Server.

Quietism answered 15/3, 2021 at 16:1 Comment(0)
S
1

Am I right to assume that there is no way now to call legacy WCF service from Blazor client-side?

Yes, you're right... WCF is not supported in Blazor client-side, and it won't be supported in the future. Microsoft has decided to stop supporting it as from .Net 5.0, and suggest to use Web Api instead.

Depending on how much you are invested in WCF, you may shift to Web API, perhaps gRPC, or go on using WCF, hoping that the efforts of the community to port and support WCF might succeed.

Symbolism answered 22/7, 2019 at 14:25 Comment(1)
Thank you. I'm not very familiar with SignalR, but from a glance, is it a "modern" way of doing Duplex communication, if considering dropping WCF?Dorsal

© 2022 - 2024 — McMap. All rights reserved.