Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Getting Started with Windows Communication Foundation Transactions : Page 2

Transactions aren't just for database applications any more. Using the unified transaction system in the Windows Communication Foundation, you can create transactable services not only for database applications, but for messaging, workflow, and other types of applications as well.


advertisement
Running the Service
To run this service, you'll need to do a little more housekeeping. First, you must change the Service.svc file to point to the new class and interface. In that file, find the line that reads:

<span class="pf">Class="MyService"

Change it to:

<span class="pf">Class="TransactableTemperatures</span>"

Next, configure the runtime to allow transactions; otherwise running the service will cause an error. To do this, from a command prompt, issue the following command:



Xws_reg --wsat+

The command configures MSDTC to handle WS-Atomic Transactions (WSAT).

Finally, of course, you need to edit the web.config file to configure the serviceModel setting for your service. The full web.config file should look something like this:

<?xml version="1.0"?> <configuration xmlns= "http://schemas.microsoft.com/.NetConfiguration/v2.0"> <system.serviceModel> <services> <service type="TransactableTemperatures"> <endpoint contract="ITransactableTemperatures" binding="wsHttpBinding" bindingConfiguration="Binding1"/> </service> </services> <bindings>

 
Figure 2. Running the Service: The figure shows the result of running the sample transactional service from a browser.
<wsHttpBinding> <binding configurationName="Binding1" transactionFlow="true" /> </wsHttpBinding> </bindings> </system.serviceModel> <system.web> <compilation debug="true"> <assemblies> <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/> </assemblies> </compilation> </system.web> </configuration>
With the web.config changes in place, running the service will now give you a screen that looks something like Figure 2.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap