How to Mock Load Balancing Environment for a WCF Service? - wcf

Please let me know if there is there anyway to Mock a Load Balancing Env. for testing WCF Services?
Thanks
PV

Matt Snider, the former PM of the WCF Routing mechanism blogged about a solution here:
http://blogs.msdn.com/b/routingrules/archive/2010/04/14/load-balancing-at-the-routing-service.aspx
The sample he mention is a part of the WCF/WF 4.0 Samples Pack (which can be downloaded here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=35EC8682-D5FD-4BC3-A51A-D8AD115A8792) is documented here: http://msdn.microsoft.com/en-us/library/ee667249%28v=VS.100%29.aspx
--larsw

Related

WCF on Azure Cloud Services with Azure Website Clients

I cannot seem to find any combination of tutorials or information online to set me in the right direction, so I'm hoping the community can help me out!
I have some experience with WCF in the past (mostly simple/default http implementations), but nothing to the level I am attempting with my current architecture. Unfortunately 99% of the info I'm finding for WCF is a couple of years old, and most of it does not address Azure specific details. Most books are published back in 2007, and do not address the newer IDE/Tooling or WCF updates since that time. Needless to say I have a few open questions, and would love to get pointed in the right direction after exhausting Google, Stack Overflow, MSDN & YouTube!
In a nutshell:
I want to centralize all business logic behind a single WCF service
on Azure (it will be load balanced on a Cloud Service).
I have a number of web clients that will be consuming this service.
All the clients are C#/.NET MVC projects that I control (I do not need or want the
WCF endpoints to be publicly available)
I would prefer to whitelist access to the endpoints, rather than
implement authentication (for performance & simplicity)
Hear are my questions and potential speed bumps:
Is WCF the right solution? Is there a newer better technology I should be using?
If I use a Cloud Service for my WCF solution, is WebRole or WorkerRole my best option and why? Are hosting the service as a Website an option? (It would save cost)
In my research I've landed on the fact that using NetTCP binding is faster than using the default Http bindings. But I can't find a simple example of how to set this up using VS 2013/.Net 4.5/Azure Cloud Service. Is there a good tutorial for this? Also, I'm assuming NamedPipes are not on option for me?
Since all the consumers of the WCF service will be running on Azure Websites, is NetTCP still possible? How do I create service references? I'm assuming I just use the NetTCP endpoint address, but what about whitelisting for security within the Azure infrastructure?
How can my Azure Website clients connect to TCP within Azure the fastest? Affinity groups don't seem to be an option for Websites, should I abandon this and deploy all my clients as WebRoles so they can share Affinity with my WCF Service? Is Azure smart enough to know that the website is calling a machine within the same region and keep the connection within the region? How is this ensured?
I will have a debug, stage and production environment for my WCF service. What is the best way to switch between the various endpoints on my azurewebsite client(s)? I'd prefer to do it during startup in my global.asax file using C#, rather than in my web.config. I only intend to keep one setting in my Web.Config for "Environment". Ideally I will have a Switch() statement in my startup file that will determine with WCF environment endpoint to use for my Service References.
My apologies for the array of questions. I was thinking about breaking this out into multiple posts, but keeping them in the same context seemed to be the only way to ensure that I am communicating the scope of my inquiry.
Thank you.
I found a great series of videos on Microsoft Virtual Academy that answers all of my questions:
Azure & Services
The key videos in this series are: 1,2 & 7. Here is a direct link to each one:
Intro to WCF
WCF on Azure
Advanced Topics

Monitoring WCF with nagios

I'm not familiar with Nagios and I'm still half way looking through the plugins and documentation but our client is currently using this and they want to use it to monitor our WCF too. Is there a way for Nagios to consume WCF methods or at least monitor the errors thrown by the WCF?
In our company, we are using Nagios for monitoring. We have also many WCF services. The only method we found is deploying NsClient++ on each server and collect WCF performance counters (calls/completed/faults, durations) There are many counters for us.
As i previously said, monitoring WCF is quite painful. see this link

Enable Tracing of Hosted WCF Service on Server

I have hosted a WCF application on server.
I need to trace the info,warnings and errors generated at server.
Please let me know the necessary changes need to be done.Please also let me know how to use the trace generated.
Regards,
Sachin K
Maybe the official doc would help: Configuring Tracing
There is also a very interesting recent post from a WCF guy explaining the whole picture in detail here: WCF Extensibility – System.Diagnostic Tracing

Can I use Compression in WCF?

we hosted WCF services in IIS 5.1 wndows xp sp3 with httpBasicBinding. The data tranferered is huge in size and transfered every 1 minute. For this to less data transfer Is it possible to compress the response of WCF service by using default http compression ? Can I have some sample code / article for using http comression in WCF?
nRk
There's a project on Codeplex available, I've used it successfully in projects.
See here: http://social.msdn.microsoft.com/forums/en-US/wcf/thread/5c67b0da-9e50-4ee1-b7ac-a4733c580980/
Anyway, have you considered compressing the data before it is sent, and uncompressing it back upon reception?
Another option would be to explore the streaming capabilities of WCF: http://msdn.microsoft.com/en-us/library/ms731913.aspx

WCF Service hosted in IIS - Can't seem to cache or retain state?

I'm trying to cache some application data that only needs to be instantiated when the application starts. I've tried using HttpRuntime.Cache, creating a static object that is instantiated only when the service starts, and I've tried making the service singleton and using global variables. Every time a new request hits the service I loose state... I could create the WCF service as a windows service I suppose, but I'd love to figure out what's happening here... I see that only one IIS worker process is spawning, but I'm guessing it's unloading and re-loading the service every time.
Am I missing some WCF configuration or possibly not setting it up right in IIS? It's running as a normal 2.0 website within IIS.
This my first post here, if someone can tell me how to post my app.config XML I will... I think stackoverflow is trying to parse it as HTML, it doesn't show up.
Thank you!
Tim
We use enterprise library caching with WCF services, works for us:
http://msdn.microsoft.com/en-us/library/dd203099.aspx
Edit
This answer is a bit old we have now stopped using Enterprise Library Caching, we use app fabric instead, see: http://msdn.microsoft.com/en-us/windowsserver/ee695849