views:

410

answers:

1

I have a WCF Service that exposes a method GetCustomers(). The internals of the method uses a Data Layer along with a Business Layer to return a List of Customers. Currently I am using an SQL Server Database file saved on the server. Everything works fine on my local network but I want to move this to the web.

I thought the best method would be to create an IIS WCF Service which makes calls to the current WCF Service's GetCustomers(). I haven't had much experience with the SQL Server Database Files but I figured I would need to move the .mdf file to the IIS WCF Service App_Data folder but I'm not sure how to change the database connectionstring and get all this to work properly. The only thing I can figure is that I will have to re-implement the GetCustomers() method in the IIS WCF Service and point it to the correct database. It seems like I shouldn't have to do this though.

I know that if I where hosting the DB in a full SQL Server implementation that this wouldn't be a problem because the connectionstring wouldn't change. That is not an option at this point.

I think I am making this more difficult than it should be.

+1  A: 

I've got some bad news - you can't access SQL Server data files directly. You have to be running SQL Server.

You're taking the Access approach, which does work without any kind of Access Server - you just point your datasource at the file and you're done. SQL Server files do not work that way.

If your database is small, consider checking out Microsoft SQL Server Express, which has most of the power of SQL Server without the expensive licensing.

Brent Ozar
It works locally, is it because when I run it locally on my server in debug mode is it creating a virtual SQL Server to host the DB?
Adam
Depends on what development environment you're using. Some versions of Visual Studio come with SQL Server Express.
Brent Ozar