• 0

[C#/WCF] MTOM causes the service call to fail


Question

Ive been toying around with MTOM on other example projects that have worked just fine. I have another example project that calls the service just fine. As soon as I add mtom as the message encoding to both the service and the client I get Content Type multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:cb781f20-b41b-429a-8e2d-de6accd8fbb5+id=1";start-info="text/xml" was not supported by service http://www.mysite.co...cf/TestSvc.svc. The client and service bindings may be mismatched.

Service config:


&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;

  &lt;system.web&gt;
	&lt;compilation debug="true" /&gt;
  &lt;/system.web&gt;
  &lt;!-- When deploying the service library project, the content of the config file must be added to the host's
  app.config file. System.Configuration does not support config files for libraries. --&gt;
  &lt;system.serviceModel&gt;
	&lt;services&gt;
	  &lt;service name="TestSvc.TestSvc"&gt;
		&lt;endpoint address="" bindingConfiguration="ITestSvc" binding="basicHttpBinding" contract="TestSvc.ITestSvc"&gt;
		  &lt;identity&gt;
			&lt;dns value="localhost" /&gt;
		  &lt;/identity&gt;
		&lt;/endpoint&gt;
		&lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
		&lt;host&gt;
		  &lt;baseAddresses&gt;
			&lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/TestSvc/Service1/" /&gt;
		  &lt;/baseAddresses&gt;
		&lt;/host&gt;
	  &lt;/service&gt;
	&lt;/services&gt;
	&lt;bindings&gt;
	  &lt;basicHttpBinding&gt;
		&lt;binding transferMode="Streamed" name="ITestSvc" maxReceivedMessageSize="2000000000" maxBufferPoolSize="2000000000" maxBufferSize="2000000000" messageEncoding="Mtom" openTimeout="10:00:00" sendTimeout="10:00:00" receiveTimeout="10:00:00"&gt;
		  &lt;readerQuotas maxArrayLength="2000000000" maxBytesPerRead="2000000000" maxStringContentLength="2000000000"/&gt;
		&lt;/binding&gt;
	  &lt;/basicHttpBinding&gt;
	&lt;/bindings&gt;
	&lt;behaviors&gt;
	  &lt;serviceBehaviors&gt;
		&lt;behavior&gt;
		  &lt;!-- To avoid disclosing metadata information,
		  set the value below to false and remove the metadata endpoint above before deployment --&gt;
		  &lt;serviceMetadata httpGetEnabled="True"/&gt;
		  &lt;!-- To receive exception details in faults for debugging purposes,
		  set the value below to true.  Set to false before deployment
		  to avoid disclosing exception information --&gt;
		  &lt;serviceDebug includeExceptionDetailInFaults="False" /&gt;
		&lt;/behavior&gt;
	  &lt;/serviceBehaviors&gt;
	&lt;/behaviors&gt;
	&lt;serviceHostingEnvironment&gt;
	  &lt;baseAddressPrefixFilters&gt;
		&lt;add prefix="http://www.mysite.com/testwcf/"/&gt;
	  &lt;/baseAddressPrefixFilters&gt;
	&lt;/serviceHostingEnvironment&gt;
  &lt;/system.serviceModel&gt;

&lt;/configuration&gt;


client config


&lt;?xml version="1.0" encoding="utf-8" ?&gt;
&lt;configuration&gt;
	&lt;system.serviceModel&gt;
		&lt;bindings&gt;
			&lt;basicHttpBinding&gt;
			  &lt;binding name="BasicHttpBinding_ITestSvc" transferMode="Streamed" maxReceivedMessageSize="2000000000" maxBufferPoolSize="2000000000" maxBufferSize="2000000000" messageEncoding="Mtom" openTimeout="10:00:00" sendTimeout="10:00:00" receiveTimeout="10:00:00"&gt;
				&lt;readerQuotas maxArrayLength="2000000000" maxBytesPerRead="2000000000" maxStringContentLength="2000000000"/&gt;
			  &lt;/binding&gt;
			&lt;/basicHttpBinding&gt;
		&lt;/bindings&gt;
		&lt;client&gt;
			&lt;endpoint address="http://www.mysite.com/testwcf/TestSvc.svc"
				binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestSvc"
				contract="TestSvc.ITestSvc" name="BasicHttpBinding_ITestSvc" /&gt;
		&lt;/client&gt;
	&lt;/system.serviceModel&gt;
&lt;/configuration&gt;

I mean...the service operations just fine until I add the message encoding to mtom on both sides. I haven't had this issue with adding mtom encoding before...is there something else I'm missing?

3 answers to this question

Recommended Posts

  • 0

well I can't seem to edit my post so I have to post again (sorry). I did notice that when I change the client side binding back to text it works when I make a call. So the server is not accepting the changes but the client is. Would there be any reason for this? The first project has similar configurations and it works with mtom just fine. This one (and every other project I've made since) refuses to accept the mtom change :(

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Where is the "Wow!" emoji? This'll have to do 🤩
    • I hear you on browser password manager, in my case I have two Google profiles, one was created when Google decided to grandfather us out of Workspace for Domains (with the replacement being too expensive for 25 users) resulting in my domain email address no longer being able to be registered to a new Workspace I created (for myself and another co-owner) so I could use Takeout and sync over some stuff to the new Workspace. Then I have my personal Google profile which I could be logged into on my desktop or Mobile, so I am saving passwords on one or the other, and when an URL changes another password for the same service gets added, it basically ends up being a giant mess. Unless I missed something is there a local decent password manager that can override the browser password managers for Chrome, Edge, Firefox (profiles) so that there is only one vault, and does that also support Passkeys (which to me are still confusing because sometimes it will ask for a Passkey on a phone I am no longer using!) Microsofts implementation of Passkeys is the worst!
    • It's utterly baffling that we have no idea when we'll get new features even well after they've been released. Why Microsoft thinks this is a good rollout strategy is beyond me.
    • If it makes anybody happy, others will need to be bitter about it. (apologies to Yogi Berra)
    • I owned a lot of Soundblaster cards over the years all the way back to the ISA slot era. I use a Soundblaster X3 external now because I'm able to run it through a KVM and have it follow the machine I happen to be using. It drives a set of JBL 305 powered monitors wonderfully. I'm not gaming or doing home theater through it, so rear channels aren't a consideration for me, though it does have side / rear / sub outputs.
  • Recent Achievements

    • First Post
      DrWankel earned a badge
      First Post
    • Reacting Well
      DrWankel earned a badge
      Reacting Well
    • Week One Done
      Supreme Spray LV earned a badge
      Week One Done
    • One Month Later
      Genuinetonerink- Dubai earned a badge
      One Month Later
    • Week One Done
      Genuinetonerink- Dubai earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      505
    2. 2
      +Edouard
      163
    3. 3
      PsYcHoKiLLa
      91
    4. 4
      Steven P.
      75
    5. 5
      Michael Scrip
      72
  • Tell a friend

    Love Neowin? Tell a friend!