views:

157

answers:

4

I am getting my head around n-tier applications. I understand seperation of code layers eg/UI, BL (Business Logic), DL(Data Layer).

In a ASP.Net application you would just reference the C# project that is doing the BL and the DL and all is well.

What I don't understand is how you would implement this on seperate servers? Do you have the DLL for the BL and DL in the bin folder but a setting in the web.config file which tells it where to go for communication or do you have the actual BL and DL running on a seperate server and then communication from the UI is made via a web service?

At the moment I have a standard ASP.Net webforms app that needs to seperate the security side to the web server and the main app on a application server, however I dont think thats possible.

A: 

This isn't directly possible without clustering, and even that requires exact copies of the application running on both servers.

If you want to run your security layer as a separate server, create it using web services, and make a web request to that service, and return the (encrypted or otherwise) response.

Hope that helps.

EDIT for continued Explanation:

In your case, I would have my security application running on a server that will authenticate, encrypt, and respond to requests made to it from a specific url or domain/sub-domain. Then my main application can live on another server and the requests to authenticate etc can be on a secondary server. However, ASP.NET authentication uses the machine-level key to create a unique salt for the authentication token. So in order to share auth tokens between multiple machines, your machine keys must be identical in the machine.config.

Jonathan
How would the request for PageA.aspx render though if its entirely on the Application Server?
Jon
+1  A: 

When we spit in to physical Tiers we use WCF between the tiers. You actualy end up getting many more layers in your application, so do not use it if you do not need it.

Typical layers would by

Client Tier

  • UI
  • Business
  • proxy

Server Tier

  • Facade
  • Business
  • Data access

Server Tier can be implemented as a single Layer if you use an ORM.

Shiraz Bhaiji
A: 

Separate servers would entail the usage of some form of web services. Here at work:

Server (piglet) - database, sql server 2005, firewall prevents connections to tigger

Server (eeyore) - web services - connects to piglet

Server (tigger) - asp.net server - connects to eeyore, firewall prevents connections to piglet

The business logic would be in a dll assembly used by the data access layer, the presentation layer, or both, and is deployed alongside them.

yodaj007
A: 

If you want the layers on physically separate servers, then you have to decide how the layers should communicate. You have lots of options for doing this: web services, Windows Communication Foundation, .Net Remoting...

  • Application Server - Instead of calling the security logic directly, call a security webservice on the web server.
  • Web Server - Hosts the security webservice. The webservice here does the actual business logic and can call the data layer.
David
Makes sense but I don't understand how if you called PageA.aspx which is on Application Server how it bubbles up to the Web Server as that is the public side of things for where a browser is looking.
Jon
There is no "bubbling up". Your web site on the application server has to make an explicit web service call to the security web service. The layering comes at a cost: you have to write more code.
David
If you made a request to www.domain.com/pagea.aspx it would go to the web server however my files are on the application server so i'm not sure how that works
Jon