• 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

    • Cheap labour, the same as the U.K. China pays their people pittance.
    • Those people that come over here on boats are already in a safe country, if they want to come over here then do so correctly though the right channels. I was born in the U.K, my family that came over here came so via the proper means. My partner came here via the correct channels, she also became a British citizen, she knows more about this country than most of them that was born here, including myself, she worked hard to do what she does. She will stick up for this country and have done a few times, when people from her own part of world have put the U.K down. We are not going to agree, all I said to start with is that maybe Trump has the right idea with this America first thing and maybe we should start doing the same. Maybe not as drastic as what he is doing, but we do need to sort this country out, we need to sort out tech instead of relying on the U.S and others. Again you have not shown why you are so annoyed that we have left the E.U and this is what it is all about? If you don't live in the U.K and live in the E.U are you annoyed that we left your little club? If you live in the U.K and is pro-E.U, then fair enough then I can see how it annoys you. Are you one of these people who lives in the U.K and have a holiday chalet in the E.U and can now only stay there for so long? If so, then that is bad luck. As I have posted before, I have no problem with people coming here to work, as long as they do if via the proper channels. We are out of the E.U, people voted out, and maybe if more people had voted instead of sitting on their backsides the results would have been different. But they like the E.U and our government thought no we would not vote to leave. How wrong they were, surprised me. I expected to wake up in the morning and hear on the radio that we voted to stay. As I said, we are out and have been for 10 years, we are not going to go back in anytime soon if we ever do, so we all need to make the best of how things are. Anyway, this is supposed to be a tech site.
    • Tim Cook: "The US over time began to stop having as many vocational kinds of skills." What's the point of wasting time getting those skills if you can't get a job with them? Good Lord, maybe he and his cohort of CEO's who exported all these jobs to China should just shut the f**k up :D
    • I made a new Cinematic/Trailer for the game, this will be the intro, still a work in progress!  I also updated the Steam page with a ton of new screenshots! 👀 https://store.steampowered.com/app/3925340/Incoherence_Dark_Rooms/  
  • Recent Achievements

    • Conversation Starter
      jessse3334 earned a badge
      Conversation Starter
    • Reacting Well
      JuvenileDelinquent earned a badge
      Reacting Well
    • One Month Later
      Excellence2025 earned a badge
      One Month Later
    • Week One Done
      Excellence2025 earned a badge
      Week One Done
    • Week One Done
      flexorcist earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      502
    2. 2
      +Edouard
      215
    3. 3
      PsYcHoKiLLa
      150
    4. 4
      Steven P.
      74
    5. 5
      macoman
      62
  • Tell a friend

    Love Neowin? Tell a friend!