![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | WS-AT or OLE Transactions I'm trying to get OLE Transactions working on Windows XP SP2. I installed ..NET Framework 3.0 and the Hotfix (Update for Windows Communication Foundation (KB912817)). When I run my sample the server starts up and listens but the client errors with the following error; System.ServiceModel.ActionNotSupportedException was unhandled Message="The message with Action 'http://QuickReturns/ITradeService/CalculateTradeValue' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)." Source="mscorlib" StackTrace: Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at ITradeService.CalculateTradeValue(Int32 qty, Int32 price) at TradeServiceClient.CalculateTradeValue(Int32 qty, Int32 price) in C:\WCF\WS-AT and OLE Transactions\client\generatedClient.cs:line 41 at QuickReturns.Client.Main() in C:\WCF\WS-AT and OLE Transactions\client\client.cs:line 35 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Service Code: public static void Main() { using (ServiceHost host = new ServiceHost(typeof(TradeService))) { host.Open(); Console.WriteLine("Trade Service in Now Running"); Console.WriteLine(); Console.WriteLine("Press ENTER to terminate the service."); Console.ReadLine(); } } Service App.config: ........ <system.serviceModel> <services> <service name="QuickReturns.TradeService" behaviorConfiguration="TradeServiceBehavior"> <host> <baseAddresses> <add baseAddress="http://localhost:8080/QuickReturns/tradeservice" /> <add baseAddress="net.tcp://localhost:8081/QuickReturns/tradeservice" /> </baseAddresses> </host> <!-- specify wsHttpBinding with the WSAtomicTransactionnal binding configuration --> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="transactionalWsatHttpBinding" contract="QuickReturns.ITradeService" name="WSAtomicTransaction_endpoint" /> <!-- specify netTcpBinding and an OleTransactions configuration --> <endpoint address="" binding="netTcpBinding" bindingConfiguration="transactionalOleTransactionsTcpBinding" contract="QuickReturns.ITradeService" name="OleTransactions_endpoint" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" name="mex_endpoint"/> </service> </services> <!-- binding configuration - this configures the transaction flow --> <bindings> <netTcpBinding> <binding name="transactionalOleTransactionsTcpBinding" transactionFlow="true" transactionProtocol="OleTransactions"/> </netTcpBinding> <wsHttpBinding> <binding name="transactionalWsatHttpBinding" transactionFlow="true" /> </wsHttpBinding> </bindings> <!--For Debugging Only --> <behaviors> <serviceBehaviors> <behavior name="TradeServiceBehavior" > <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> Client Code: static void Main() { // Create a client using either wsat or oletx endpoint configurations //TradeServiceClient client = new TradeServiceClient("WSAtomicTransaction_endpoint"); TradeServiceClient client = new TradeServiceClient("OleTransactions_endpoint"); // Start a transaction scope using (TransactionScope tx = new TransactionScope(TransactionScopeOption.RequiresNew)) { Console.WriteLine("Starting transaction"); // Call the Add service operation // - generatedClient will flow the required active transaction int qty; int price; int result; // Call the CalculateTradeValue service operation // - generatedClient will not flow the active transaction qty = 100; price = 15; result = client.CalculateTradeValue(qty, price); Console.WriteLine(" Sold ACN Qantity {0}, For$ {1} With a Total Value of ${2}", qty, price, result); // Complete the transaction scope Console.WriteLine(" Completing transaction"); tx.Complete(); } Console.WriteLine("Transaction committed"); // Closing the client gracefully closes the connection and cleans up resources client.Close(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); } Client App.config <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings> <netTcpBinding> <binding name="transactionalOleTransactionsTcpBinding" transactionFlow="true" transactionProtocol="OleTransactions" /> </netTcpBinding> <wsHttpBinding> <binding name="transactionalWsatHttpBinding" transactionFlow="true" /> </wsHttpBinding> </bindings> <client> <endpoint address="http://localhost:8080/QuickReturns/TradeService" binding="wsHttpBinding" bindingConfiguration="transactionalWsatHttpBinding" contract="ITradeService" name="WSAtomicTransaction_endpoint"> </endpoint> <endpoint address="net.tcp://localhost:8081/QuickReturns/tradeservice" binding="netTcpBinding" bindingConfiguration="transactionalOleTransactionsTcpBinding" contract="ITradeService" name="OleTransactions_endpoint"> </endpoint> </client> </system.serviceModel> </configuration> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| [CTP2:] File System Transactions | PowerShell | |||