TransactionFlow to WCF from Visual Studio 2010 Express

I am trying to get started with transactions in WCF using the free Microsoft Visual Web Developer 2010 Express. This gives me the opportunity to create a “WCF service application”, but it doesn’t seem to give me many options for hosting it or setting up different bindings. If I have an F5 project, I get an error:

At least one operation on the 'Service' contract is configured with the TransactionFlowAttribute attribute set to Mandatory but the channel binding 'BasicHttpBinding' is not configured with a TransactionFlowBindingElement. The TransactionFlowAttribute attribute set to Mandatory cannot be used without a TransactionFlowBindingElement.

I tried adding the */services/service/endpoint configuration to web.config, but it seems to be just ignored. I also tried changing the default startup application to WcfSvcHost.exe, but this option is inactive. I'm starting to suspect the express version of some of the flaws, but I'm optimistic that it's just me, being a fool. Is there a trick I need to learn or splash out the full version of Visual Studio 2010 to get me in this hurdle and the next?

Thanks!

+4
source share
2 answers

Without knowledge of your configuration and service contract, it is almost impossible to make a targeted answer. If you think your configuration is being ignored, make sure that the names used in service and endpoint/@contract contain CLR namespaces.

WCF 4 uses a nice simplified configuration, which IMHO created a real configuration much more pain than before. You can switch the default values ​​by adding this to your web configuration:

 <protocolMapping> <remove scheme="http" /> <add scheme="http" binding="wsHttpBinding" bindingConfiguration="transactionFlowEnabled"/> </protocolMapping> <bindings> <wsHttpBinding> <binding name="transactionFlowEnabled" transactionFlow="true" /> </wsHttpBinding> </bindings> 

This is a workaround that should use a specific binding as the default instead of basicHttpBinding .

+6
source

Thanks to the Ladislav suggestion, I was able to solve this problem by adding the following entries to the Web.config file:

 <services> <service name="WcfService1.Service1"> <endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1" /> </service> </services> 

and

 <bindings> <wsHttpBinding> <binding transactionFlow="true"/> </wsHttpBinding> </bindings> 
+1
source

All Articles