Windows Communication Foundation (WCF) allows you to create a service that exposes an ASP.NET AJAX-enabled endpoint that can be called from JavaScript on a client Web site. To create such an endpoint, you can either use a configuration file, as with all other WCF endpoints, or use a method that does not require any configuration elements. This topic demonstrates the second approach. To create services with ASP.NET AJAX endpoints without configuration, the services must be hosted by Internet Information Services (IIS). To activate an ASP.NET AJAX endpoint using this approach, specify the WebScriptServiceHostFactory as the Factory parameter in the @ServiceHost directive in the .svc file. This custom factory is the component that automatically configures an ASP.NET AJAX endpoint so that it can be called from JavaScript on a client Web site. For a working example, see the AJAX Service Without Configuration . For an outline of how to configure an ASP.NET AJAX endpoint using configuration ...
Difference between Web Service and WCF? Major Difference is That Web Services Use XmlSerializer But WCF Uses DataContractSerializer which is better in Performance as Compared to XmlSerializer. Key issues with XmlSerializer to serialize .NET types to XML Only Public fields or Properties of .NET types can be translated into XML. Only the classes which implement IEnumerable interface. Classes that implement the IDictionary interface, such as Hash table can not be serialized. The DataContractAttribute can be applied to the class or a strcture. DataMemberAttribute can be applied to field or a property and theses fields or properties can be either public or private. Web Services : 1.It Can be accessed only over HTTP 2.It works in stateless environment WCF : WCF is flexible because its services can be hosted in different types of applications. The following lists several common scenarios for hosting WCF services; IIS WAS Self-hosting Managed Windows Service Important difference ...
Often do we want to pass some data to some or maybe all our service operations. This data is usually context data such as user tokens (user information), or environmental preferences of the user or machine (in Respond terminology: UserConext object).
In these kind of situations, we would rather not add additional context parameters to the contracts or our services, because we don’t want to involve implementation data / context data with the business parameters of our services. A nice and easy way to pass that data is to use MessageHeaders. In order to do this we follow these steps: Add the context data to the outgoing message headers. Call the operation (Nothing special here). Extract the data from the incoming message headers. Using an OperationContextScope In order to add the message header, you should have a OperationContext for your call. An OperationContext will automaticly be created for the call, and will be available in the service side. If one wishes to add the message he...
Comments