Concerns over having WCF Services be the DAL

Concerns over having WCF Services be the DAL

Old forum URL: forums.lhotka.net/forums/t/3770.aspx


SoftwareArchitect posted on Wednesday, October 24, 2007

Client application is a web app (ASP.NET)  that is hosted by a third party (external to the customer) site.  The app uses a CSLA business objects assembly...and, since it is a external, it will be using the web services portal.  The portal is located on a machine sitting in the corporate DMZ. 

Once the dataportal methods are invoked (on the machine in the DMZ), how should I perform the data operations?  We are concerned about opening up the ability to query the internal databases directly from that machine in the dmz.  So, the thought is to build a WCF host internally that pretty much just executes queries.  Then, open up access to that internal WCF host and have the business objects use that instead of the typical datareader/sqlcommand code.    Thus a DAL built with WCF.

Questions:
Any concerns with this architecture?  
It it acceptable to allow machines in the DMZ to do direct database access?
Any guess on performance impact in shuttling datasets around as opposed using datareader directly?

Thanks,
Mike Stover

JoeFallon1 replied on Wednesday, October 24, 2007

The whole idea of the DataPortal is that your server in the DMZ can *avoid* talking directly to the DB and instead talk to an app server (Web Server) located on the other side of the firewall (inside Corporate.)

For this you simply need to follow standard CSLA coding techniques (mainly no DB communications unless you are in a Dataportal_xyz method.)

Then you can switch between local dataportal (the web server can talk to tthe DB server) and a remote dataportal (your web server talks to a 2nd web server which talks tot he DB for you) by changing your config file.

The BOs are shuttled back and forth through the DataPortal automatically because they are serializable.

You can begin implementing WCF as the Remoting mechanism - but be sure to get the eBook before even thinking about it. There is a lot of information there which you should know before deciding if it is worth it.

Joe

DavidDilworth replied on Thursday, October 25, 2007

Can we just clarify the situation you are describing.   Are you talking about a situation where you have the following physical requirements.

The web server is an externally hosted server outside the control of the corporation.  This will communicate with an App server that is inside the "outer" corporate firewall, but outside the "inner" corporate firewall (I believe that is what you mean by inside the DMZ).

There is a "primary" App server inside the DMZ that for security reasons cannot communicate through the "inner" firewall to access the DB.  Therefore you want to configure the "primary" App server to communicate with a "secondary" App server that is inside the "inner" firewall.

The "secondary" App server is inside the "inner" firewall and this server does have access to the DB server.  This server will perform all SQL requests against the DB.

Have I understood the situation correctly?

SoftwareArchitect replied on Thursday, October 25, 2007

David - you have it exactly correct.
------------------------------------------------
Joe - not sure how I can make a "double hop" through to the internal app server that CAN query the db directly.  Let me explain...

InnerAppServer | DMZ Zone AppServer -----internet ----  Externally Hosted WebServer

If my website (client) were running on the DMZ AppServer I could certainly pass my business objects into a data portal running on InnerAppServer; however, my client is hosted outside of the corporate network and that server (and the rest of the internet at large) can only communicate with the DMZ zone Server. 

Thus, the current setup looks like:
WCF DataPortal | WebService DataPortal ----internet---- ASP.NET client

Thanks,
Mike Stover


DavidDilworth replied on Thursday, October 25, 2007

I thought that's what you were getting at Smile [:)].  That's an interesting configuration problem you have there.

I wonder if Rocky, or someone else at Magenic, has already had experience with that type of configuration?

It's an obvious web-based scenario that you are describing.

DavidDilworth replied on Thursday, October 25, 2007

Actually, I've just had a further thought on this topic based on some other work we are doing with Exchange Server 2007.

I think, the key thing here is that you don't want to de-serialize the objects in the DMZ.  You really only want to do that when reach the "inner" App server.

So what you need in the DMZ is a relay service.  Something that takes the request, but immediately passes it on to the ultimate target.

So we managed to achieve something like this using a Web Service wrapper that sits around the Web Service API for Exchange Server 2007.  "Our" Web Service runs on a server and just takes the request and forwards it to the real Exchange Server Web Service with no de-serialization.  And as far as the client consumer is concerned it looks like the request was handled by our Web Service.

If you used Web Services as the transport in both cases that might solve the problem.

Is that a possibility?

ajj3085 replied on Thursday, October 25, 2007

I think there was a similar "relay" requirement discussed on this forum before.  Rocky's suggestion was to implement a dataportal which handled this relaying.  It would be similar to remoting, for example, that simply does the remoting call then passes to the simple data portal.  In this case, it would pass it to whatever dataportal is configured on the app server. 

DavidDilworth replied on Thursday, October 25, 2007

I'd need to check our implementation details for our Exchange Server solution.  But if my memory is correct, we achieved it all with zero code.  It just used configuration settings to achieve the result.

RockfordLhotka replied on Thursday, October 25, 2007

ajj3085:
I think there was a similar "relay" requirement discussed on this forum before.  Rocky's suggestion was to implement a dataportal which handled this relaying.  It would be similar to remoting, for example, that simply does the remoting call then passes to the simple data portal.  In this case, it would pass it to whatever dataportal is configured on the app server. 

Yes, this was my recommendation.

I think the overall architecture here is pretty iffy. It seems like the relay "app server" does nothing but add overhead to the solution.

But if you do need a data portal relay, it wouldn't be that hard to write. Just create a data portal service/host like I do in Chapter 4. The data portal is all interface based, so all you need to do is create objects with the right interface so the message gets routed to your relay object. Your relay object would then contact the real app server and just pass the message along. That real app server would run a normal data portal configuration.

SoftwareArchitect replied on Friday, October 26, 2007

Agreed.  The relay app server is absolutely nothing but overhead.  At present, there is no way to get the business objects from the client (asp.net app) to a machine where the databases can be accessed.  The best possible scenario would be for the company to host the website themselves, thus alleviating the need for this middle physical layer.  I am not sure that is going to be possible though.

Thanks for all of your replies.  I appreciate the professionalism found in this forum and the willingness [of many] to offer advice/suggestions.

Mike Stover

Copyright (c) Marimer LLC