Sunday, February 13, 2011 12:28 AM
I am relatively new to WCF but i have had a baptism by fire over the last couple of weeks. And i am very interested in implementing configuration services. I have 3 questions
I am essentially bolting configuration services on to an existing Service Implementation. I have gone through all of the example projects and the StockTrader source numerous times, but the stocktrader is a very well defined and highly optimized service (too much detail) and simple service host and Test Harnesses lack the complexity i was looking for(namely datacontracts, and non configuration service client contracts,Implementation handled). Essentially I am in a goldylocks situation with the samples.
What I am seeking guidance on is the process of Hooking up SVCUtil.exe client code, or repository created client code from an external service(source not accessible) and implementing that into a ConfigurationServices Host Environment and/ or Configuration Services enabled client application. I have built an architecture (out of my legion of virtual servers) to emulate a tier'd environment and successfully configured hosts in IIS with corresponding applications. However I am basically stuck at the creation of a configuration services enabled client application to external services where all I have to work with is the repository\svcutil client code.
After creating the repository with the ConfigurationImplementation,Settings,Contract. I am confused as to next step with the Service_Client lib. Should that just be placed into the Implementation project for the Contract? And then just place the service address into the client_ endpoint?
With regards to Integrating Enterprise Library 5.0 WCF Exception handling into the service. Where exactly would be the best place to implement the Exception Policy and Trace definitions so the configuration service application repository can store it and use it.
Why are these forums so quiet after the new release?
“Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.” -Terry Pratchett
Monday, February 14, 2011 5:42 AMI am confused as to next step with the Service_Client lib. Should that just be placed into the Implementation project for the Contract? And then just place the service address into the client_ endpoint? Cheap Replica Watches,Replica Swiss Watches
Thursday, March 17, 2011 3:13 AM
Friday, March 18, 2011 2:08 PMModerator
First I should ask, what benefits are you trying to get for your scenario from config service?
You do not have to do anything with the config service client generation, yet still implement in your host application to use configweb, manage config updates across multiple running nodes for your app. You could do a full stop at the point in the tutorial where you are done doing the host implementation. Then, just follow MSDN WCF guidance to generate a client for the external service, and use this client however you want in your implementation logic. You might want to test out svcutil.exe by running it against the simpletesthost.exe program or serviceahost.exe in the stocktradersample. SVCUTIL (which is part of win sdk) generates both a data contract and service contract for the service, but places them both in the same generated cs file. It also generates the binding your client will use, and the client definition (both which you need to add to your config file in the <servicemodel> section. So, you can implement config service in a host, but not necessarily use it to add/manage/monitor clients---just std wcf. As for any WCF client, you do not need to use svcutil.exe to generate a svc/data contract when you do have access to the actual service contract/data contract (source or compiled assembly) for the remote service (if they are .net). If you do have these (ala StockTrader), then you can create projects with these directly in your solution, and activate directly without generating a service/data contract; just std wcf programming (which at first is a bit tricky if you have never used WCF, it takes a bit to get comfortable with, but once you do, well worth it).
I can help if you have issues--you can even email me at firstname.lastname@example.org.
As for using config service client capabilities; this makes sense if you want config service to manage endpoints for you; there are multiple endpoints, and/or want to load balance against multiple endpoints. I use, for example, for an app that runs on-premise, that is .NET, but calls into a java web service running across several servers (load balanced by apache). Here, I use config service client to setup the 6 endpoints to the tomcact servers, and load balance w/failover across them from my .NET client app (whcih is an ASP.NET Web app).
You can use svcutil.exe to generate a C# client against a remote service, embed the client generated .cs file into a project, and cmpile into an assembly in VS. The run repository tool with configservice, goto client tab, and browse for/find this assembly. It will generate a client that simply uses this assembly for the data and service contracts; but this client inherits from the configservice load balancing client, and when you activate/use it in your app, you then get load balancing failover. You should get to this point first. Then ping me back. Final step is creating a 'generic' connected service definition in configweb. You do this in remote services page. Here you need to define:
a) A logical group name that will be used as alogical grouping for any/all endpoints to this remote service (there may be one endpoint oinly, or many as in my case wth 6 tomcat servers).
b) A user defintion. This user definition is not used in any way for actual authentication (although it can be, optionally). Rather, just an internal thing for config service to use, again having to do with how it manages endpoinits; so pick any username/password, it will be created and associated w/ the connected service defintion.
c) A service friendly name. This is important becuase you instantiate the client using it within your app logic when making a remote call. For example MyClient client=newClient("TheFriendlyServiceName"); then subsequent code would be myreturnobject = client.CallHello("HelloService); except now you are potentially load balancing/with failover (rouind robin is used) if rwemote service is running on many endpoints, not a load balanced address/ip address.
d) You just create 'connections' to the endpoints (one or many); config service groups them logically and knows to use them for this client. Once you 'add' the new defintion from updateconnectedservice.aspx page in configweb (client is of type 'generic' since remote service is not a config-service service); you can then add 'connection points' which are simply endpoints to the service. You code then simply activates.
Finally, the 5.0 version will be out Tuesday. I am updating docs next week, which will be pubklished shortly therafter and take your feedback to make docs/walkthroughs easier. Also doing some VS templates so projects are created for you with all right references added, so do not need to create projects manually and manually add referenbces to shared libraries + using statements.
Greg Leake, Microsoft