Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


SSWUG


Reader rating:
Click here to read 30 comments about this article.
Article source: CoDe (2007 - Jan/Feb)


Article Pages: < Previous - 1 2 3 4 5  6 


Hosting WCF Services (Cont.)

IIS 7.0 and WAS Hosting

On Windows “Longhorn” Server machines, you can host your WCF services with the Windows Activation Service (WAS). WAS is a process activation service installed with IIS 7.0 that decouples the activation architecture from IIS in order to support non-HTTP protocols such as named pipes, TCP, and MSMQ. Like IIS 6.0, WAS also provides features for idle-time management, health monitoring, process recycling, and management tools for configuring application pools among other things.

In this section I’ll explain how WAS hosting works, show you how the hosting architecture compares to IIS 6.0 hosting, and provide you with some tips for getting started with WAS.

WAS Hosting Architecture

IIS 7.0 introduces some architectural changes necessary to expand support for named pipes, TCP, and MSMQ protocols. The new architecture relies on protocol listeners, listener adapters, and protocol handlers to process requests.

  • Protocol Listeners: A protocol listener is responsible for receiving requests for a particular protocol. There is a protocol listener provided for HTTP, named pipes, TCP, and MSMQ. For HTTP, the HTTP listener is http.sys (same as in IIS 6.0). Listeners for other protocols are provided by their respective listener adapter service.
  • Listener Adapters: A listener adapter is responsible for bridging requests between WAS and the worker process for a particular protocol. There is a listener adapter for HTTP, named pipes, TCP, and MSMQ. WWW Service provides the HTTP listener adapter. IIS provides Windows services for each of the other protocols, supplying a protocol listener and listener adapter pair (Figure 5).
  • Protocol Handlers: A protocol handler channels requests through the service model for a particular protocol. WCF provides managed protocol handlers for HTTP, named pipes, TCP, and MSMQ.

Click for a larger version of this image.

Figure 5: How listener adapters and protocol handlers process requests with WAS hosting.

As each protocol listener receives requests, WAS checks for the existence of a worker process to service the request (according to application pool configuration). The listener adapter’s job is then to pull requests from the application pool queue and forward to the appropriate protocol handler for processing. Figure 5 illustrates this architecture and flow.

To support this new architecture there are two services:

  • Windows Activation Service (WAS): This service handles configuration, application pooling, and process activation for all protocols.
  • WWW Service: This service provides the listener adapter for the HTTP listener, http.sys.

Table 2 shows these and other services that support the architecture shown in Figure 5. Ultimately, it’s the protocol handler provided by WCF that ensures the ServiceHost instance has been created before requests can be processed.

Regardless of protocol, the service model handles all requests in a consistent manner, but WAS provides a message-based activation mechanism like IIS 6.0 to increase the overall reliability and scalability for requests over any protocol.

Enabling WAS

You’ll need to perform a few steps to configure IIS 7.0 and WAS before you can successfully host WCF services over any protocol. As you would with IIS 6.0, you’ll first have to make sure the machine has IIS 7.0 and WAS installed. With these Windows components installed you can configure WAS for the protocols you want to support for each Web site.

IIS provides a new command-line utility to configure Web sites-appcmd.exe. HTTP protocol is supported by default, but with this utility you can enable support for named pipes, TCP, or MSMQ for any Web site or application directory. The following illustrates enabling named pipes, TCP, and MSMQ support for the default Web site:

%windir%\system32\inetsrv\appcmd.exe set site 
"Default Web Site" -+bindings.[protocol=
'net.pipe',bindingInformation='*']

%windir%\system32\inetsrv\appcmd.exe set site 
"Default Web Site" -+bindings.[protocol=
'net.tcp',bindingInformation='*']

%windir%\system32\inetsrv\appcmd.exe set site 
"Default Web Site" -+bindings.[protocol=
'net.msmq',bindingInformation='*']

After executing these commands, IIS updates the configuration file for WAS, applicationHost.config, with new <binding> entries for the Web site. IIS nests site configuration inside the <system.applicationHost> section as shown here:

<system.applicationHost>
  <sites>
    <site name="Default Web Siteid="1">
      <bindings>
        <binding protocol="http
bindingInformation="*:80:/>
        <binding protocol="net.pipe
bindingInformation="*/>
        <binding protocol="net.tcp
bindingInformation="*/>
        <binding protocol="net.msmq
bindingInformation="*/>
      </bindings>
    </site>
  </sites>
</system.applicationHost>

This section governs what protocols the Web site and WCF services can support. Put another way, services can only expose endpoints that use service model bindings matching the supported protocols for the application.

Choosing the Right Hosting Environment

As I mentioned at the beginning of this article, choosing a hosting environment for your services is something that is largely driven by your operating platform and choice of protocol. Now that you’ve had a chance to explore the different hosting environments, you can probably guess that the best possible hosting environment would be WAS for its rich set of features and protocol support. Unfortunately, WAS is only available on Windows Vista or Windows “Longhorn” Server machines.

Table 3 summarizes the hosting options available to you on each operating platform, including client and server platforms. Based on this summary, you will likely make one of these choices for your production services on each server platform:

  • For Windows “Longhorn” Server machines you’ll use IIS 7.0 and WAS.
  • For Windows Server 2003 machines you’ll use IIS 6.0 for HTTP and Windows services for other protocols.

For client systems the choice is a little bit more complex. In-process services introduce the least configuration overhead for clients, thus you’ll be using Windows Forms or WPF clients as your self-hosting environment. If the system is a complex, distributed system where you have significant control over setup, you may install Windows services to provide services for Windows XP machines. For Windows Vista machines your choice of self-hosting with Windows services or enabling WAS may be governed by client preferences.

Michele Leroux Bustamante

&


Table 3: A summary of hosting options based on operating platform and communication protocol.
Operating PlatformProtocolHosting Options
Windows XP/SP2HTTPIIS 5.1 or self-host
Named Pipes, TCP, MSMQSelf-host
Windows VistaHTTP, Named Pipes, TCP, MSMQWAS or self-host
Windows Server 2003HTTPIIS 6.0
Named Pipes, TCP, MSMQSelf-host
Windows “Longhorn” ServerHTTP, Named Pipes, TCP, MSMQIIS 7.0/WAS or self-host


Article Pages: < Previous - 1 2 3 4 5  6 

Page 1: Hosting WCF Services
Page 2: Declarative Configuration
Page 3: Self-Hosting
Page 4: Managed Windows Services
Page 5: Message-Based Activation
Page 6: IIS 7.0 and WAS Hosting

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
3.2 out of 5

211 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      AppsWorld Europe

 

SSWUG