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
 

The Windows Communication Foundation: A Primer : Page 2

The Windows Communication Foundation (WCF)—formerly known as Indigo—is Microsoft's new connected systems platform for Windows. This is the first in a WCF article series covering everything from first principles and "Hello, World!" to building fully connected applications.


advertisement
Services, Behaviors, and Bindings
When using WCF, there are three things that you need to configure in web.config: Services, Behaviors, and Bindings.

Services
The Service setting is important for two things: First, the location of the behavior (explained more in the next bullet), and second, the type of service, defined using its namespace, in this case Devx.Indigo.Samples.TemperatureService.

The service element has a child <endpoint> element where you specify the binding (more on this later) and the contract. The contract is defined by the interface (from Listing 1) using its fully qualified name.

Behaviors
 
Figure 1. Running the WCF Service: After creating the service, when you access it from a browser, you will see a screen similar to this that shows how to use the service.
The behaviors element lets you configure how the service should react under particular circumstances. It needs a configurationName attribute so that the service can map to it. In Listing 2, the service has been configured to return any unknown exceptions as faults.

Bindings
You define the bindings and the binding types within the bindings element. In this case, the element is simple, specified as an HTTP type binding, identified as Binding1. Check the MSDN documentation and the schema (defined at the top of this config file) for more options.

Save the web.config file in the same directory as your application, and you're almost ready to go.

The final thing you need is the service mapper. Create a text file in the tconvert directory and call it "service.svc." It should contain the following single line of code:

<@Service language=c# Debug="true" class="Devx.Indigo.Samples.TemperatureService" %>

Your Indigo service is now ready to go. You access it via the URL: http:///TemperatureService/service.svc. You can see the results of this in Figure 1.



Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap