ClaySys AppForms Enterprise 1.5
In the modern world most of the large scale deployment requires multi tier deployment to ensure high availability of applications. ClaySys AppForms Enterprise can be installed on a multi tier environment. Lets consider that the the deployment requirement is as following:
- The applications need to be developed following a Multitier architecture
- Each tier should be physically separated for security.
- The business logic tier is the only one that can connect to the data tier.
- The presentation tier only connects to the business logic tier.
- The presentation tier may not directly connect to the data tier.
- The presentation tier is located in a DMZ, other tiers are heavily secured.
The communication between different tires of the application should work like the example provided below:
Proposed Design
The service proxy requirement can be done using the feature in IIS7 called Application Request Routing. The details of this feature are explained below.
Application Request Routing
IIS Application Request Routing (ARR) 2.0 or above enables Web server administrators, hosting providers, and Content Delivery Networks (CDNs) to increase Web application scalability and reliability through rule-based routing, client and host name affinity, load balancing of HTTP server requests, and distributed disk caching. With ARR, administrators can optimize resource utilization for application servers to reduce management costs for Web server farms and shared hosting environments.
http://www.iis.net/download/ApplicationRequestRouting
The following steps can be used to install and configure IIS Application Request Routing:
Preparing the server(s)
- Make sure you have IIS 7 or above installed
- Download the Application Request Routing extension from :
- Install the extension
- Finally we’ll configure the Application Request Routing.
In IIS Manager, click your server and go to Application Request Routing Cache:
Important note: If you work with multiple servers (and that’s what you’ll do in a real environment), you need to do this on your presentation tier (the ASP.NET website containing the Silverlight application).
5. On the right select Server Proxy Settings and check the box Enable proxy.
Creating the site for the presentation tier (and reverse proxy)
In the presentation website, i.e. the website hosting the asp.net application, open the application pool go to Advanced Settings and change the Idle-Time out to 0 minutes.
And finally go to Recycle, and clear the Regular time intervals (in minutes) checkbox.
Configuring IIS Application Request Routing and IIS Rewrite
- Open the web.config of the PresentationSite (running on the presentation tier).
- Now add the following to the configuration file:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled=true
multipleSiteBindingsEnabled=true />
</system.serviceModel>
<system.webServer>
<validation validateIntegratedModeConfiguration=false />
<rewrite>
<rules>
<rule name=Reverse Proxy to Business Logic Tier stopProcessing=true>
<match url=^services/(.*) />
<action type=Rewrite url=http://logictier/{R:1} />
</rule>
</rules>
</rewrite>
</system.webServer>
This will make sure all requests to the path services are forwarded to our logictier server (containing the business logic tier).
- Now, visit the page: http://presentationtier/services/Manage.svc
And there you have it. Even though we’re visiting a page on the server presentationtier it’s showing us content from the logictier server.
This means our Silverlight application no longer needs to talk to the logictier server. And thus, we don’t need to expose our logictier server to the internet or put it in a DMZ.
Note 1: The clientaccesspolicy.xml file we placed in the LogicSite is no longer required.
Note 2: The system.serviceModel part in the config is very important. If it’s missing you’ll get the following error:
In your browser:
Server Error in ‘/’ Application.
The resource cannot be found.
In EventViewer:
WebHost failed to process a request.
Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/27111447
Exception: System.Web.HttpException (0x80004005): The service ‘/services/Manage.svc’ does not exist. —> System.ServiceModel.EndpointNotFoundException: The service ‘/services/Manage.svc’ does not exist.
The final result in our ClaySys AppForms Application
- Check the web.config if it still contains the URL Rewrite configuration.
- Change the appsetting for the service url to the presentation layer (http://presentationtier/services)
And we’re done…
If you want you can start Fiddler and you’ll see that our ClaySys AppForms application is only accessing our presentationtier server:
Get Started with our Appforms Development Services