4

I thought I would try out .Net Core (v1.1.2) and one of the things I wondered about was if it was possible to call a WCF service written in .Net Framework 4.5.2. I am using Visual Studio 2017 and installed the Microsoft WCF Web Service Reference Provider (version 0.5.10428.1201). When I ran it, it found the service, but I got this error message when trying to generate the code:

Scaffolding Code ... Error:Warning: Unsupported message encoding value: 'Mtom'. It must be 'Text'. Warning: Unsupported message encoding element type: 'System.ServiceModel.Channels.MtomMessageEncodingBindingElement'. It must be one of the following types: 'System.ServiceModel.Channels.BinaryMessageEncodingBindingElement', 'System.ServiceModel.Channels.TextMessageEncodingBindingElement.' Warning: Endpoint 'WSHttpBinding_IDocumentSignService' at address 'http://xxxxxxxxxxxxx.svc' contains one or more bindings not compatible with .Net Core apps, skipping... Error: No endpoints compatible with .Net Core apps were found. Failed to generate service reference.

(I edited the url to http://xxxxxxxxxxxx.svc)

Does this mean that .Net Core apps can't call all WCF services yet? Will it only support a certain subset? So that if I am stuck in a world of WCF services I will have to stay away from .Net Core? Or is it simply a problem with the tooling?

I realize this has probably been asked before, but I could find no clear answer.

Halvard
  • 3,891
  • 6
  • 39
  • 51
  • If you google the error message you'll find it's not about .NET Core or WCF, it's about using MTOM in the service itself. As the error explains, you have to either change MTOM to Text, or add another binding that uses Text instead of MTOM. – Panagiotis Kanavos Jun 27 '17 at 09:15
  • @PanagiotisKanavos, In my mind I should not need to change the WCF service to get this to work. It is a service used by many old and existing projects. I don't have a similar problem generating the code if I do the same from a .Net Framework 4.5.2 project and there MTOM works just fine. – Halvard Jun 27 '17 at 09:28
  • 2
    `by many old and existing` and .NET Core is new, with its own limitations. As the docs explain Text is less efficient but more interoperable. You'd have the same problem with *ANY* client that didn't support MTOM. MTOM isn't required for WS-I compliance. If the client doesn't understand MTOM, you need to include Text. You don't have to change the code either, endpoints are defined in the configuration – Panagiotis Kanavos Jun 27 '17 at 09:31
  • @PanagiotisKanavos Thanks for your explanation. Conclusion: Dropping .Net Core in this project for now as I can add additional binding with messageEncoding="Text", but not remove exisitng binding messageEncoding="Mtom". Will try it for a less integration-needy project. – Halvard Jun 27 '17 at 11:00

1 Answers1

1

As explained by panagiotis's comment, you're consuming a SOAP service with MTOM encoding (what is not supported by .net Core) Nevertheless, consuming WCF services works fine in .Net core, as long as it is not relaying on WS* bindings. extra info here

I was also having trouble by consuming MTOM encoded SOAP services. I explain how I fixed it here

Tim
  • 151
  • 1
  • 4