WF4 delay/ resume in WorkflowServiceApplication on IIS5 and 6 - iis-6

I have my workflow hosted in a WorkflowServiceApplication running on IIS5 (production environment will be IIS6) with a persistence database. It's a request/approval service so there's a delay (a few days) whilst waiting for approval and if that delay passes with no approval the workflow sends an e-mail to the approver. I've noticed that the pending workflows only "wake up" and send their e-mails if I kick off a new request (i.e. new workflow instance). I assume that in starting a new flow something checks the instance store for instances that are due to resume and resumes them. I've only just noticed the problem because I was previously testing with delays that were just a few minutes rather than days. I haven't tried it on IIS6 yet but I expect it would be the same.
q1) do I need to write a console app or something to periodically check and resume the flows and if so can someone advise how to do it? Or have I just done something wrong?
q2) Assuming that the answer to Q1 is "yes, you need to write something" if I was to use IIS7 and AppFabric (which may be possible) would the sleep/resume just work without me having to write any code to check and resume the flows? i.e. just deploy the workflow service into AppFabric and it works?
Thanks in advance.

The answer to q1 is yes. After an IIS AppDomain recycles it is not restarted until there is an external request for it. As a result the WorkflowServiceHost is not active and expired Delay activities will not be resumed. With versions of IIS before 7 you need to create an external request to make sure the WorkflowServiceHost is available. The easiest way of doing so is just have a windows service periodically retrieve the WSDL page.
If your upgrade to IIS7 and AppFabric you can configure a service to automatically start as soon as IIS is running and that will take care of the same problem. I would prefer this option as AppFabric gives you a lot of extra benefits like tracking.

Yes Windows Server AppFabric's Workflow Management Service will wake up workflows with pending timers. You get this for free as well as other goodies.

Related

Web app deployed on kestrel goes into idle mode

I have ASP .Net core webapi deployed on IIS 7.5 (Windows 2008 R2). I have controllers as well as listener classes (which wait for a message to arrive on a RabbitMQ message) which perform the same functionality.
The problem is whenever webapi is deployed on IIS or has some idle time, the RabbitMQ messages don't get picked up. Only if I make a API call to the control does the application 'wake up' and picks up the message.
Tweaks I have tried:
In the application pool,
set 'Idle timeout' to 0 .
set the 'Disable Overlapped Recycled' to true.
set 'Disable recycling for configuration changes'.
I have no idea what is causing this. I need the application to pick up messages immediately and have no idle time. Could anyone please point me in the right direction?
As a complete workaround, you can keep your app alive by sending requests all the time. In my case, I don't even have access to changing IIS settings.
To send requests I use Availability feature in Application Insights -- it lets you create tests that send GET requests to your app as often as every 5 minutes. You can read more about it here.

IIS Application Recycle drops static classes

I'm using Simple Injector in my WCF service. While running it from VS2010 everything is fine. However, when I publish it to my server using IIS 7, after some time (20 min, counted) my WCF loses all registered assemblies, modules, classes in container.
I guess IIS recycles the WCF Service Application Pool and drops my container registrations.
Can anyone help me on this?
While there exists many legitimate cases of using self-hosting WCF services, however, approaching self-hosting just because of IIS recycling may be counter productive.
Hosting in IIS gives you a lot benefit during development and daily operations, and I am not going to repeat what benefits which you could easily find out in google search.
So when IIS receive the first request to your application, it will launch a worker process named "w3wp.exe" according the settings in the application pool associated with your web app. And by default IIS will shutdown in 20 minutes of idle time. Check the Advanced Settings of the application pool, you will find a lot settings for the life cycle. You won't get such flexibility and robustness through self-hosting out of the box.
So basically you could have a few options provided you decide to stay with IIS hosting.
Change the Idle Time-out to 24-hours or even a month.
Write a small program or use cUrl to ping your application every 10 minute.
Leave it as it is
If you want to keep states during operations, save them in disk, then load them during next launch triggered by a request.

How to force startup of WCF service

I have an IIS hosted WCF service, and a client Windows application which, upon the first use of the day, takes a while to respond to the first service call. I believe this to be because IIS shuts down services which are not used for a period of time (and the delay is the restart time for the service). I was wondering whether I could alleviate this by making an asynch call when my application starts up (just to, potentially, get the service to start). I therefore, upon application start, created a "fire and forget" background thread which just opens a connection to the service. The intention being that when my application has finished its own startup, and wants to use the WCF service, the thread will (probably) have finished and the service startup delay will not be encountered by the user.
Is this reasonable ? Is opening a channel to the WCF service enough, on its own, to start the service, or do I need to write some dummy method and call that ?
Thanks
Ross
Check if you really want your app to handle this task and checkout the AppWarm-Up Module for IIS, maybe you can use this without adding code to your serivce.
Is this reasonable ?
It doesn't sound like a good approach to me. If you have control over how the service is hosted I would advise you to self-host it.

How to run biztalk orchestration every X minutes

I have an orchestration that is started by a public port published as service. Everytime somebody calls this service the orchestration starts
I need to start the orchestration every 30 minutes too.
Whats is the better approach?
I've seen some here but I would like something more simple
As the blog post you referenced states, BizTalk doesn't really do scheduling. Besides the approaches referenced in that post, I don't think there is really an easier approach to this problem. You mention your orchestration is published as a service. Could you create a simple command line application that calls your service and run that via Windows Schedule or SQLAgent?
There is a reason it does not do things every X minutes. It would be a wrong usage of BizTalk. BizTalk is publish and subscribe. The repetitive process is for WIndows Services and if they need processing then, send to BizTalk from Windows Server.
When you do not publish, you do not receive.
This behaviour can be achieved, however, by an orchestration subscribing to an inbound port (file for example) and then drop a file back at the end.
Write a batch file with reference to windows sheduler

What services are required for AppFabric to run properly and monitor WCF Services

I'm running AppFabric on IIS7 with Windows 7 for development.
AppFabric works fine for some period of time, but then it will stop updating.
I can send service requests through, and AppFabric doesn't show them in the dashboard when I refresh it.
I think a service is stopping, or there's a permission issue. Does anyone know what services are required to for AppFabric to run properly?
SQL Server and AppFabric Event Collection Service, off the top of my head (for event collection; there are other services, but since you say AppFabric itself runs requests, I presume they're OK). There's also Event Tracing for Windows, but it's not, strictly speaking, a service.
I presume you've also checked the tracking profile is set correctly and have looked in the Application event log?