views:

108

answers:

4

My WinFroms application uses tableadapters & datareaders to fetch data from an SQL server.

I am thinking of replacing the datareaders stuff with web services for security reasons. I guess one of the cons will be the execution speed.

Is it true? Or...

+3  A: 

Web services definitely have a higher overhead in terms of execution speed - purely because in a typical SOAP implementation, the data you are bringing back will be wrapped in XML. So you'll be pulling more raw info down and then asking your app to parse it into the correct types.

I'm not sure how you plan to use web services to benefit your security situation. Bear in mind that you'll need somewhere for these services to live, and that your client application will need to be able to hit that location.

Paul Alan Taylor
He does not need to use SOAP. WCF supports binary over TCP/IP or Named Pipes.
John Saunders
Nice for the protection of investments in a big environment. Only real Webservices or JMS offer interpoerability. Don't use proprietary binary connections.
Martin K.
His clients are Windows Forms applications. Interoperability doesn't appear to be an issue. If it became an issue, it's trivial to add a SOAP endpoint.
John Saunders
@Martin K: how can you say "interoperability" and "JMS" in the same sentence? The "J" stands for **Java**, doesn't it?
John Saunders
A: 

Using netTcpBinding or netNamedPipesBinding, the performance won't differ that much. These bindings use a binary encoding over TCP/IP or Named Pipes, respectively.

Yes, you will get better security, since you won't be connecting to SQL Server directly from each client.

You may even have some opportunities to improve performance. If you happen to be making a number of small calls to the database, then consolidating them in a larger WCF call can actually improve performance.

John Saunders
I would like an "intermidiate" between my app and the SQL server.The app could "talk" with the webservice, not the Sql server directly. I suppose that way it would be better.
Chocol8
I don't see how that would increase security at all.
John Saunders
The connection string to the Sql is on the client side. I though that by using a web service, i would avoid such things. We have a newbie here...
Chocol8
No problem. You just didn't say that before. That makes better sense. Yes, you can improve security _of the connection string_ by not having it on the client, but instead, in the web service.
John Saunders
A: 

Surely the security of your application as it is now depends on how you connect to the MS SQL DB. Do you authenticate your clients when they use the application at all? I have seen plenty of instances where the user logins are actually SQL logins and this is what provides the security and can allow data segmentation in the DB based on those logins quite natuarally.

If you only have one login, which I hope is not SA, connecting for all the users of your application then having a seperate Data Access Layer sounds a sensible design choice. You are obviously thinking of web services for this layer but you could also consider other options. Maybe these SO questions might help;

Best design practices for .NET architecture with LINQ to SQL (DAL necessary? Can we truly use POCOs? Design pattern to adopt?)

Business Object DAL design

Dave Anderson
+1  A: 

Yes, you'll get better security - adding layers always helps, especially if you then take steps to protect each one. For example, if you only allow access to the web service and allow access to the sql server from your web server only, then you've reduced the target area hackers could use to get at your sql server.

Of course, now you're in the position where they need to hack your web server to be able to get at the sql server. If you further reduce the area by putting the web service code into a service and only allowing that to access your sql server then you're doing a lot better - the web service code acts solely as a wrapper to the middle-tier service; now they need to hack the web server which will only let them get access to the service, and that will contain your proprietary interfaces that should be more difficult to hack (assuming the hackers are attacking your web and sql servers using known security flaws, eg 0 day attacks).

I know several places that are paranoid on security (financials mainly) here the web server is considered a security risk, so very little is run in there - it acts as part of the presentation tier solely to pass data through to a secured service, that in turn manages a secure connection to the data tier.

See Roger Session's article on Software Fortresses for an introduction.

As for speed.. well, nowadays servers are so fast you can take an object, convert it to SOAP, post it over HTTP, parse it, unpack it back to an object and call the method you wanted all along without too much noticeable delay. Of course it's slower, but if you can scale it so it is fast enough, then who cares nowadays?

gbjbaanb
And, if he doesn't _use_ SOAP, it will be even faster.
John Saunders