n-tier deployment

Eduardo Lorenzo

Well-known member
Joined
Jun 27, 2006
Messages
86
hi everyone

my issue is this:
The web application I am developing now is scheduled to be deployed following the n-tier architecture where the webpages shall reside in a webserver, the business and DAL shall be in an application server and of course the data in a database server.

I have adjusted my architecture to the best of my abilities to "fit" the n-tier architecture by:
1) Creating each layer as a separate project. I created a Solution with all of these projects inside.
2) One of the projects(Datalayer) is the datalayer/business layer, the other project is the webservice(OBPWebService) and the third project is the web layer (Interphase)
3) Interphase goes to the datalayer through the webservice (web referenced)

I believe this is as far as I can go.

Now the project is at about 85% of completion, my boss gave me three more desktops and asked me to simulate the n-tier architecture by installing the projects on each machine. and use my machine as the "client".

My first Idea, which I am going to attempt right after posting this, is to build deployment packages (one for each project) and installing them on each of the three "servers"

I really am in the dark as to how to do this and most resources I have found point to single-server deployment.

All help shall be extremely apprecieated.

Thank you in advance.
 
As long as you arent hard coding things like connection strings or URLs to web services this shouldnt be too difficult.

You could build a deployment package for the web layer and deploy that to one of the 3 machines. Create a separate deployment package for the web service layer and deploy that to a second machine. Depending on how you have designed the Data Layer (i.e. is it a class library) then this might need deploying to the same PC as the webservice.

You should then be able to browse to the web layer and hopefully things work.
 
thats what I did yesterday. I created separate deployment packages for each of the layers.. and am going to try that today as soon as the network guys finish setting up and introducing the "servers" to each other..

I do have a question

Depending on how you have designed the Data Layer (i.e. is it a class library) then this might need deploying to the same PC as the webservice.

what scenario will i be looking at to need to deploy the data layer in the same PC as the webservice? The admin here "DOES NOT, i repeat DOES NOT" to quote him.. allow anything else but the aspx pages on the webserver..
 
Does the webservice itself use the Data Layer? If so it will either need to be available to the webservice either on the local machine (usually in the bin folder of the webservice or the GAC), it could be accessed from a remote PC as a stndard file share although this will have implications for your security configuration.

Also your sysadmin could have a problem on his hands as depending on your deployment model the web application / webservice themselves will have a bin folder which contains one or more dlls anyway, not sure how that will fit in with his ideas.
 
well yes.. the webservice actually has a reference to the data layer.. but all the webservice does actually is stand in between the pages and the other tiers/layers.

Does this mean that the webservice will also be installed on the WebServer machine? shoot..

Yes the web service has a bin folder with the reference to the BLL.. the BLL has a bin folder that has DLLs pertaining to the DAL.

Darn.. this would not have happened if they decided to use the n-tier architecture on the get-go.. oh well..

BTW. I still havent installed them on the desktops yet because the Network guys still havent finished introducing the desktops to each other. and I think they will also simulate everything including firewalls..

update: "Give us till thursday" says the network guys... :mad:
 
Last edited by a moderator:
A web service is nothing more than a web application and will need to be installed on a web server, this could be a physically different machine to the customer facing web server however.
 
well to put it as simple as possible..

when the aspx page needs data.. it calls a function in the webservice which in turn calls another function in the datalayer.

the datalayer then connects to the tables and returns the data in a dataset. The datalayer passes the dataset to the webservice and the webservice passes the dataset to the aspx page.

thats how it goes.. does this "architecture" pose any problems? If so, I really would like to know because the network guys still hasnt been able to connect the desktops (something about the admin not allowing a sub-network inside the office) and I still have time to once again re-architecture the application for the second time around once more again... :D
 
The architecture itself sounds fine, the only real issue I could see from your original couple of posts is how the web service talks to the data layer.
 
well the webservice has a reference (Add Reference) to the DAL/BLL and is instantiated in a basic way.

Code:
<WebMethod()> Public Function fetchData(ByRef targetDS as Dataset) as Boolean
Dim myDL as new DataLayer.clsDataLayer
If myDL.fetchdata(targetDS) then
errMsg = ""
Return True
Else
errMsg = myDL.errmsg
Return False
End If
End Function

its basically like this. Is this wrong? I mean, this is my first n-tier deployment and I really want to get this right the first time.
 
That sounds fine - its just that if the webservice references the DAL / BLL then the DLL will need to be available to the web service, this normally means it will be in the bin folder of the webservice itself.
 
PlausiblyDamp said:
That sounds fine - its just that if the webservice references the DAL / BLL then the DLL will need to be available to the web service, this normally means it will be in the bin folder of the webservice itself.

shoot.. yes it is going to be in the bin folder with the web service. Is there a way for me to fix this? I will start emulating the deployment on three desktops after I finish this post (and coffee)

I may still have time to fix it.
 
Not really, you could install the DAL / BLL into the Global Assembly Cache (GAC) on the webserver hosting the webservice but it will still be on the webserver.

It is technically possible to store the dll on a network share and access it from the web server - however it isnt a simple job and the end result is likely to either compromise security even more (the web server now loads its dlls from an arbitrary network share which could be less secure that the server itself - this being a potential security issue), possibly fail to work if there is a firewall between the web server and the file server with the DAL / BLL shared out (changing this configuration is again likely to cause further security implications).

Even if you overcome these obstacles the code contained in the DLL is still going to be executed on the web server anyway - and as such has exactly the same security implications (or even worse as you will probably need to alter the CAS policy to give this file server FullTrust) as if it was physically stored on the server.

It might be easier (or worth trying anyway) to see how set in stone the Admins policy of nothing but .aspx files on the server is (especially considering the fact a web application or service will contain other files anyway - web.config, web.sitemap, ascx files, asmx files and quite possibly one or more dlls in the bin folder anyway).
 
It might be easier (or worth trying anyway) to see how set in stone the Admins policy of nothing but .aspx files on the server is (especially considering the fact a web application or service will contain other files anyway - web.config, web.sitemap, ascx files, asmx files and quite possibly one or more dlls in the bin folder anyway).

I must put this lightly to preserve my light mood...

Set In Stone - is putting it mildly. They guard their servers and RULES like a mama bear. :(

does this mean I will have to re-model/ re-code my webservice?
Am really confused as to how to deploy (or at least where to deploy) the webservice when the webservice project itself has its own dll?

ps.

I will sincerely appreciate if you can visit this thread. And also to give you a more precise idea on what I am facing right now. Thank you very very much.
 
Last edited by a moderator:
You really should only have one place where the connection string is defined - that would be your DAL.

The web service would call into the DAL and request data but the DAL itself would be responsible for managing the DB connection and any commands etc. that need to be executed. The web service would never need to access the DB directly.

You might want to split the Business Logic from the Data Access by putting each into its own DLL - this will allow you to potentially replace either the DAL or BLL at a later date without having too great an impact on the other components in the system.
 
Back
Top