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

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


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
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date