Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content issue in .NET Core app Consuming a WCF service

Tags:

.net-core

wcf

I am trying to call a WCF service method from an .NET Core Web API using the new Visual Studio WCF Connected service.

But when I am testing this, I get the following error:-

The content type multipart/related; type="application/xop+xml"; start="http://tempuri.org/0"; boundary="uuid:9e7f9b02-4d9c-4ec1-bad4-1007704a579a+id=1197"; start-info="text/xml" of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: ' --uuid:9e7f9b02-4d9c-4ec1-bad4-1007704a579a+id=1197 Content-ID: http://tempuri.org/0 Content-Transfer-Encoding: 8bit Content-Type: application/xop+xml;charset=utf-8;type="text/xml"

The exposed WCF service uses MTOM MessageEncoding and in traditional .NET framework client application, we can set the client to use MTOM in the application's config file but in .NET core, we don't have the config file where we can set the MessageEncoding and all this configuration is taken care of in the code present in Reference.cs(which is a generated file). I thinking changing this generated file to set the MessageEncoding is not a good option.

Any idea on what is the best way to handle this issue?

like image 299
Nirmal Thakur Avatar asked Dec 07 '22 18:12

Nirmal Thakur


1 Answers

I just came to know from WCF Core team that currently MTOM encoding is not supported in .NET Core based clients. This is a requested feature which will be available in future versions. Here is github link which has more information: Adding MTOM support in WCF runtime

like image 177
Nirmal Thakur Avatar answered Feb 11 '23 23:02

Nirmal Thakur