WCF: Availability of the WCF services

The requirements look easy:
We need to monitor the health of the WCF services, availability of the WCF services. Are they up or down?
But we don’t want to call operations of the service because it sometime could change the service internal status and these changes are out of our control.
Some services have special Heartbeat() operation to make the health monitoring easily, but the most have not.
We don’t have to check the work status of the web-method. That means we don’t care if some underlying services, like SQL databases, don’t work and the services available but response with errors. We just want to know are web-services up or down, could they response at all or not. It should be something really easy.
Let’s start:
I thought this is quite routine task to the service consumers and there should be several routine decisions.
As I know the OpsMngr2007 use something simple to measure the web-service health.
I’ve asked gurus on the MSDN forums about this.
Dan Rigsby proposed:
“A one way Ping() method on the server works well. If there is an exception, then the channel is broken. You can have a timer run Ping against the server at some interval.
If this is a duplex callback system you need to be careful. The server might also need to check if the client is still alive. You cant have both the servicecontract and callbackcontract have the same named methods, so you will have to rename one of them.”
Thanks, Dan!

I’ve tried to
>ping http://text.company.com/adfadfad/asdfadf/adfadfadf.asmx
and
>ping http://text.company.com/adfadfad/asdfadf/adfadfadf.asmx?wsdl

The ping works only for the host name, like
>ping text.company.com
not for web-service URL

It is not what I want.

It checks the health of the host, not the web-service.
It does not cover cases with several services on the one host.
It does not cover cases when the host is OK but the service is not response.

Islam Eldemery proposed:
“try to subscribe to the events of the communication object (in the client side), so if a service stopped or disconnected you may handle the fault event.. (remember that it can only fault once).

proxy.InnerChannel.Faulted +=
new EventHandler(InnerChannel_Faulted);

or
proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

see my example of handling a service in a chat application
http://www.codeproject.com/KB/IP/WCFWPFChatRoot.aspx
if this is a duplex communication, to handle the service on the service side, try to check every time on each callback object you have, to see if someone has been aborted or not before you using it (may be a client disconnect for a network failure.. etc.)”

Islam, thanks for response!

Unfortunately with this technique we can intercept only errors after we unsuccessfully call the service operation, right?
It is not our case. We want to check the availability not “post mortem” but proactively. For instance, click a button and get health of all services. And we cannot call the service operations, it’s one of requirements.
Martin16 proposed:
“…
Additional ideas (for IIS/HTTP WCF Services) are
1) a custom availability operation in your service which checks all resources and gives back a result your web application monitor can parse.
2) enable WCF performance counter and create a monitor on top of that.
3) buy Avicode MP (should provide native WCF Service support)”
Thanks for help, Martin16!

Yeah, 1) is the Heartbeat() operation. It doesn’t work in my case where the services are out of mu control.
For 2) First, we want actively to request the health status not to listen how the service responses to the requests of the other clients.
Second, the WCF performance counters… OK I use them with OpsMng2007 I don’t like them very-very much. (It’s another story).
3) The third-part utils should use the same APIs we use, not something secret. I also use OpsMngr2007. But I want to use simple and absolutely open (to me) source code.


So far so good.
Is it possible to use Mex endpoint or something like HttpRequest to <URL>?wsdl to make sure the service is up?

I’ve got one method from the book “Programming WCF Services” by Juval Lowy (page 71).
Code Snippet:

MetadataExchangeClient mexClient =

bool isServiceUp = true;
try
{
string address = “http://localhost/MyService.svc?wsdl”;new MetadataExchangeClient(new Uri(address),MetadataExchangeClientMode.HttpGet);
MetadataSet metadata = mexClient.GetMetadata();
// if service down I get the exception
}
catch (Exception ex)
{
isServiceUp =
false;
}

I catch the Exception like {“Metadata contains a reference that cannot be resolved: “http://localhost/MyService.svc?wsdl”} System.Exception {System.InvalidOperationException}
Easy and don’t heavy load the service.
P.S. Please, make sure you’ve read good comment by Islam Eldemerybelow.
========================================================================================

Neudesic to assist in Microsoft ESB Implementation for Jordanian Government

Last year I went to Jordan to work with Microsoft on an ESB proof-of-concept for the Jordanian government. The press release below explains how it ended 🙂

I am really excited about this project. We have a stellar team forming around this project, and some very cool work ahead. .

 

Keep scrolling down, there are some good photos further down!

 

 

Here’s a picture from the contract signing:

Here’s a picture of Bill Gates and His Excellency the minister at the official contract signing kicking off this project (which happened at an e-government symposium in the UAE in January).

 

Here’s our official press release:

 

NEUDESIC TO ASSIST IN MICROSOFT ESB IMPLEMENTATION FOR JORDANIAN GOVERNMENT

Enterprise Service Bus To Strengthen Jordanian Government’s e-Government Offerings

IRVINE, CALIF. – APRIL 25, 2008 – Neudesic, a leading Microsoft National Systems Integrator and Gold Certified Partner, recently ranked # 197 on the Inc. 500 List, has announced that it has been selected by Microsoft to assist with the implementation of an Enterprise Service Bus (ESB) for the Jordanian government.

“Microsoft’s selection of Neudesic for this strategically important project is a further testament of Neudesic’s leadership role in the services-oriented architecture and enterprise service bus space,” said Neudesic’s VP of Technology Tim Marshall.

The project will include the design, implementation and rollout of an ESB that will be used across all government ministries, and with external trading partners and agencies, to further extend, automate and streamline the range of government services that are available as e-government offerings to citizens and partners.

“We are looking forward to working with Microsoft and the Jordanian government to rollout an ESB that will serve as foundational infrastructure and meet their e-government communications needs for years to come,” said Brian Loesgen, Neudesic’s BizTalk architect for the project.  “The government has recognized that a contemporary services-oriented infrastructure would provide them with the most agile and flexible messaging and integration platform, and that the Microsoft technology stack was perfectly suited to their needs.”

Jordan has historically been at the vanguard of e-government services, offering efficient processes with completion time unheard of in many countries, such as passport issuance within 2 days and drivers’ licenses in 2 hours.  Their adoption of ESB messaging will strengthen this position.

“We look forward to working with Neudesic on this project.  With their proven track record of success and depth of experience with these technologies, they will ensure that the results of this project will meet, or exceed, the government’s expectations,” said Khaled Chebat, Microsoft’s Services Lead for the Eastern Mediterranean.

 

And lastly…

I work hard, and I play hard. I’m not the sort to sit in a hotel room wishing everything was just like at home. The Jordanian people are super-friendly, generous and hospitable (well, except for when they get behind a steering wheel :)). I had lots of fun last year exploring the country, and I have more great adventures planned.

Here’s a photo of me from a couple of weeks ago, at about 25 meters depth in the Red Sea, in front of the Cedar Pride wreck in Aqaba Jordan. It was deliberately sunk approx 25 years ago, and was far more interesting than other wrecks I’ve done. I took a bus down (about 4 hours) from Amman, spent the weekend in Aqaba, then took a taxi back following the Dead Sea route. I wanted to go that route primarily because the desert route would have been a steep altitude gain right at the start, not a good idea after a morning of diving, and as an added bonus, got the spectacular Dead Sea coast.

Much better way to spend my off-hours than hanging around the hotel watching CNN!

Technorati Tags: ESB Guidance,ESB,BizTalk,SOA

 

BizTalk Sftp Adapter – Updated

I published the Sftp adapter on Codeplex a couple of month ago, and got lots of feedback since then. A couple of issues where found, and these has been fixed:

  • Fixed port configuration
  • Multiple use of Macros such as %MessageID%_%SourceFileName%, now works
  • Blogical.Shared.Adapters.Common.dll is now gac'ed after installation

Previous posts:

  • BizTalk Sftp Adapter – updated to support dynamic send ports
  • BizTalk Sftp Adapter – Troubleshooting
  • BizTalk Sftp Adapter released at CodePlex

Inbound HIPAA filename capture

I received an email today about this entry:

I have written a biztalk application ( biztalk 2004) which uses hipaa adapter 3.0 to accept a 835 claim payment schema.The application works fine when edi file supports single transaction set(ST/SE). When i try to process file with multiple ST/SE it reads the first set but ignores the rest.

I also use the logic you’ve provided in your blog to capture file name of the document using correlation set.

The error logged in the event log is as follows

Error encountered: ERROR (121), interchangenr 10744 : An error occurred in the BizTalk Server 2004 connector. Check the details. Document was rejected by BizTalk

What you have to do is set up a correlation set and capture multiple transactions, have a loop shape and receive multiple transactions (each having the same control number (ISA13), and have a timeout value and once that timeout occurs end the orchestration.

BizTalk Server 2006 R3 Announced!

Apologies…this post has been in my drafts and i assumed it was published..Well, without any more delay…please find enclosed the announcement on BizTalk Server 2006 R3!

Steven Martin who is the Connected Systems Program Manager has announced the next revision of BizTalk Server named as “R3″. This new version of BizTalk Server is aligned in the […]