How can I enumerate all currently executing WCF operations? - wcf

I'd like to get/create a collection of all currently executing operations and select metadata (available from OperationContext).

Read this article, is there library to queue and eventualy cancel async opertions in WCF. It can be useful in your case.
If you plan to build monitoring tool You can host WCF services using the appfabric framework on Windows Server. Appfabric provides an IIS extension that can be configured to trace and log WCF calls to a SQL Server DB and have monitoring dashboard in IIS admin console. More information here and here.

Related

C# call server service from wcf web service

I have developed a WCF Web Service using C# that works and serves up the data I need to my mobile client using a COBOL VM that talks to my backend data. It works, but it is very unreliable. I think it has to do with the lifecycle of the web service and I just don't understand how it is breaking down. I believe the problem is the COOBL VM, which is a singleton, and the process of shutting it down each time. I've already tried
lock(myobject)
{
... run my code here
}
I want to move the COBOL VM to a server service where I can persist my COBOL VM and just make calls to it. I don't know how to persist the COBOL VM across all WCF Web Service calls. I'm looking for examples the show a wcf web service communicating with a server service so I can move my business layer code out of the service and just have it make calls to the server service for the data it needs. This way I can keep the COBOL VM running all the time rather than going through a load-up, execute, and then shutdown process as I'm doing in the Web Service.
Does anyone have any GOOD examples of a WCF Web Service communicating with a WCF Server Service?
keep the COBOL VM running all the time rather than going through a load-up, execute, and then shutdown process as I'm doing in the Web Service.
Then create a Windows service that hosts this VM client, so you only have to connect once and can keep it running. Then you can let that service also host a WCF service, which then queries the VM client.
You might be better off looking into a CORBA solution - CORBA is the only remoting technology that can give you access into an already running process.

WCF tracing in Azure production

How do I set WCF tracing in Azure (production environment) so that I'll have logging of all WCF errors?
Can't you use Windows Azure Diagnostics for this purpose? Once it is properly configured, your trace logs will be available in a Windows Azure Storage account that you have specified in your code. More information about Windows Azure Diagnostics can be found here: https://www.windowsazure.com/en-us/develop/net/common-tasks/diagnostics/.
Just like Guarav said, you can simply use the Azure diagnostics to log all errors to your storage account (there's a good read in the MSDN Magazine: Take Control of Logging and Tracing in Windows Azure).
Now I personally don't like the 'flat' logging when working with WCF. I find it very important to be able to trace through activities. That's why for all Azure projects where I use WCF I don't use the normal diagnostics.
I use a trick documented by Christian Weyer where I log to a classic *.svclog file and have those files shipped to my storage account. Then I use the CloudBerry Storage Explorer to simply view those logs that include the activites. This is possible by creating a custom XmlWriterTraceListener that writes to a local resource which is shipped to your storage account.

WCF Hosting Options Suggestion

I am looking for suggestion for hosting my WCF enterprise application.
The app. require to run without stopping at the server. It also use TCP to yield the best performance at the intranet environment.
I am thinking to host it at window service because IIS recycle process, and has timeout.
However, I find this from the msdn http://msdn.microsoft.com/en-us/library/ff649818.aspx :
Window service...Lack of enterprise features. Windows services do not have the security, manageability, scalability, and administrative features that are included in IIS.
Does it mean Window Service is not suitable for enterprise application? But How about MS SQL, Oracle, MySQL etc. They all host at Win. Service right?
Regards
Bryan
Windows service is suitable for enterprise application! The quoted text actually means that IIS has a lot of built-in management features which are not available in custom hosting (like windows service) unless you implement them at your own.
One of such features is the recycling you want to avoid which helps application to keep low resource consumption (server is in healthy state). Another such feature is IIS checking of the worker state. If worker process looks stuck (don't process requests for any reason), IIS will start automatically another process and routes new requests to that process.
IIS + WAS + AppFabric can provide very big feature set but they are not good for every scenario. If you have service which requires some background continuous, scheduled or multi threaded processing it is probably better to move to self hosted scenario.

Control persisted WF instance (xamlx) without AppFabric

I have a workflow service (xamlx) which implements some complex business process (with persistence and correlation). This service is hosted in IIS and I use AppFabric to control workflow instanses (Terminate them or Cancel).
Now I need to allow users, who don't have administrative rights and, hence, access to AppFabric to stop workflows (Terminate) if they make mistakes while invoking it and restart the workflow.
Is it possible to implement the same logic as it is used in AppFabric with C# code (I plan to create a web service with the help of which it would be possible to terminate workflows)
Thanks in advance!
The AppFabric use a Workflow Control Endpoint to handle all commands you issue using the UI. You can use the WorkflowControlClient in your code to do the same thing. Note that by default the AppFabric used the NetNamedPipeBinding which only allows for local connections so you might need to add another binding like the BasicHttpBinding.

Windows Service Container

For my projects I need quite often to create windows services.
I need them for scheduling operations, file system watching, asynchronous or long running side tasks (backup files, sending messages, check incoming mail to process, notifications etc).
I also use them to expose WCF services that are cross applications in the enterprise.
The self hosted scenario seems to me more appropriate as we are still on II6 that is quite limited (only http) for exposing WCF.
Most of) the services need also to expose some kind of administration interface (web or desktop) for reporting, starting and stopping the various services etc.
Seems strange to me that a "host container" that leverages most of these features (host, install new services, remote ui for admin, exposing wcf, scheduling etc) with some kind of mef plugins doesn't already exists.
What are the options if I do not want to start from scratch?
I am a developer for an open source windows service hosting framework called Daemoniq. I understand how installers can be an inconvenience so creating installers on the fly is one of its features. You can download it from http://daemoniq.org
Current features include:
container agnostic service location via the CommonServiceLocator
set common service properties like serviceName, displayName, description and serviceStartMode via app.config
run multiple windows services on the same process
set recovery options via app.config
set services depended on via app.config
set service process credentials via command-line
install, uninstall, debug services via command-line
Please feel free to have a look at it. Code contributions are also welcome =D
Thanks!
There is one host server in development (Microsoft) - codename Dublin.
The possible option would be to create one Windows Service - host application, which will load all of your WCF services and create ServiceHost for each of them (for instance, through reflection).
Having only one windows service would make it easy to administer all service hosts (you wouldn't have to administer windows service, but only in-process hosts).