Welcome Guest! To enable all features please Login or Register.



How to generate server/client WCF service configuration
#1 Posted : Friday, August 24, 2012 7:29:24 PM(UTC)

Xomega provides a way to specify one or more endpoint configuration templates for your WCF services and then generate the initial client-side or server-side set up for each of the services defined in your Xomega service model. If you include such generation into the build of the Xomega model then it will help you automatically take care of updating the service configurations whenever you add new services. Once added, the endpoints will not be modified during subsequent regeneration, which allows you to customize them without fearing of losing your changes.

The steps to set up endpoint configuration templates are as following.
  1. Open the global configuration file for your model, which contains config element as the root. If you don't have such file, add one to the Xomega project by clicking the Add New Item menu on the project and selecting the Xomega Model Configuration template.
  2. Add or locate the wcf:services element inside the global config element, where the wcf prefix should be mapped to the "http://www.xomega.net/wcf" namespace, and configure the namespace for the generated services.
  3. For each type of binding that your WCF services will support, add a corresponding wcf:endpoint element inside of the wcf:services element.
  4. Set the binding attribute to a standard or custom WCF binding name.
  5. Set the baseLocalAddress attribute to the base URL of the server-side endpoints for this binding. It should include the protocol and the port number and end with a slash. The service name will be appended to it for each individual endpoint. For local development, when both the services and the client are running on the same machine, it can also be used for the client-side configuration.
  6. If the client and the services will be running on different machines, then set the remoteLocalAddress attribute to specify the base URL of the server to be accessed by the client.
  7. If you have configurations for multiple bindings, then set the namePrefix attribute to allow generating a unique endpoint name for each binding.

Below is a sample configuration that demonstrates these steps.
<config xmlns="http://www.xomega.net/omodel"
  <wcf:services namespace="MyProject.Services" implNamespace="MyProject.Entities.Services">
    <wcf:endpoint binding="netTcpBinding" baseLocalAddress="net.tcp://localhost:8008/"
                  baseRemoteAddress="net.tcp://remotehost:8008/" namePrefix="tcp"/>
    <wcf:endpoint binding="wsHttpBinding" baseLocalAddress="http://localhost:8080/" namePrefix="http"/>

To generate server/client WCF service configuration perform the following steps.
  1. Open the properties of the WCF Server Configuration or the WCF Client Configuration in the Service Layer generator group.
  2. Set the Output Path to the server-side or the client-side configuration file.
  3. For the server configuration you can also specify the Endpoint Behavior and the Service Behavior that would be used by each generated endpoint and service respectively.
  4. Run the generator and review the generated endpoints in the output file. If you need to make a change in the model configuration and regenerate, then you need to manually delete the generated endpoints first.
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.