WF4 is one part of .NET Framework 4.0, which means WF4 workflow can be hosted and run in any type of application running with the .NET framework. We can host a workflow as a WCF service. We can also invoke a workflow service from a workflow or host workflow in an ASP.NET application and handle all the business logic behind the page.
When we design workflow applications, please let workflow be workflow. Don’t couple workflow with other logic. For example, in this chapter, hosting workflow in ASP.NET is for conception demonstration only, not the best practice. In the real world, most of the time, workflow should be implemented as a workflow service hosted in IIS7 or AppFabric.
AppFabric is an IIS7 extension that includes many tools to help us host a workflow service. AppFabric is to workflow service like IIS7 is to ASP.NET website. However, we can run a workflow service in IIS7 without AppFabric installed. Although AppFabric is powerful, we need to spend some time to learn it. For more information about AppFabric, you can check this link: https://www.microsoft.com/en-us/download/details.aspx?id=27115
The process of sending an e-mail would consume some time – maybe a few seconds or even minutes. It would be a waste of time and resources for our applications to stop and wait for an e-mail sending action to complete. Because sending e-mail is time-consuming, a better design is to strip this feature out as an independent WCF workflow service and host that service in IIS7.
We need the SendEmailActivity activity to send an e-mail.
Click OK. We will find SendEmailActivity in the toolbox:
The final workflow will look as shown in the following screenshot:
We should be able to find the following module and handlers in IIS7:
If we cannot, then we should reinstall .NET framework 4.0 or repair it. Here are the repair commands:
Repair command for 32-bit:
.NET Framework 4 Full (32-bit) – silent repair %windir%Microsoft.NETFrameworkv4.0.30319SetupCacheClient setup.exe /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart
Repair command for 64-bit:
.NET Framework 4 Full (64-bit) – silent repair %windir%Microsoft.NETFramework64v4.0.30319SetupCacheClientsetup.exe /repair /x86 /x64 /ia64 /parameterfolder Client /q /norestart
We just need to open our mail. A new mail with subject Hello WF Service indicates that we have created and hosted the WF service successfully.
Simply put, once we have set up the IIS7, we need to copy all the workflow service project files and folders to the IIS application folder and the workflow service will just work.
We can also host a WF4 service in IIS6 once we have installed .NET framework 4.0. Running a WF4 service in IIS6 is not recommended.
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…