Welcome Guest! To access all forums & features, please register an account or sign-in. → Why register?



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


3 replies to this topic - - - - -

#1 sathenzar

    Resident Fanatic

  • 873 posts
  • Joined: 12-June 06

Posted 08 May 2012 - 23:26

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:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
	<compilation debug="true" />
  </system.web>
  <!-- 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. -->
  <system.serviceModel>
	<services>
	  <service name="TestSvc.TestSvc">
		<endpoint address="" bindingConfiguration="ITestSvc" binding="basicHttpBinding" contract="TestSvc.ITestSvc">
		  <identity>
			<dns value="localhost" />
		  </identity>
		</endpoint>
		<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
		<host>
		  <baseAddresses>
			<add baseAddress="http://localhost:8732/Design_Time_Addresses/TestSvc/Service1/" />
		  </baseAddresses>
		</host>
	  </service>
	</services>
	<bindings>
	  <basicHttpBinding>
		<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">
		  <readerQuotas maxArrayLength="2000000000" maxBytesPerRead="2000000000" maxStringContentLength="2000000000"/>
		</binding>
	  </basicHttpBinding>
	</bindings>
	<behaviors>
	  <serviceBehaviors>
		<behavior>
		  <!-- To avoid disclosing metadata information,
		  set the value below to false and remove the metadata endpoint above before deployment -->
		  <serviceMetadata httpGetEnabled="True"/>
		  <!-- 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 -->
		  <serviceDebug includeExceptionDetailInFaults="False" />
		</behavior>
	  </serviceBehaviors>
	</behaviors>
	<serviceHostingEnvironment>
	  <baseAddressPrefixFilters>
		<add prefix="http://www.mysite.com/testwcf/"/>
	  </baseAddressPrefixFilters>
	</serviceHostingEnvironment>
  </system.serviceModel>

</configuration>



client config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
	<system.serviceModel>
		<bindings>
			<basicHttpBinding>
			  <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">
				<readerQuotas maxArrayLength="2000000000" maxBytesPerRead="2000000000" maxStringContentLength="2000000000"/>
			  </binding>
			</basicHttpBinding>
		</bindings>
		<client>
			<endpoint address="http://www.mysite.com/testwcf/TestSvc.svc"
				binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITestSvc"
				contract="TestSvc.ITestSvc" name="BasicHttpBinding_ITestSvc" />
		</client>
	</system.serviceModel>
</configuration>


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?


#2 OP sathenzar

    Resident Fanatic

  • 873 posts
  • Joined: 12-June 06

Posted 09 May 2012 - 14:40

It may also be worth nothing this happens with a WCF Application (as opposed to a WCF Library) template as well.

#3 OP sathenzar

    Resident Fanatic

  • 873 posts
  • Joined: 12-June 06

Posted 09 May 2012 - 17:26

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 :(

#4 OP sathenzar

    Resident Fanatic

  • 873 posts
  • Joined: 12-June 06

Posted 09 May 2012 - 17:38

I feel like such an idiot. I appears the problem would be that the server config did not have the bindingConfig property in the binding (I could've sworn it did). *sigh* sorry to waste everyones time.