Here's the problem : We have quite a website which works with quite a database. The end user can only reach the web-server, the web server itself is the only one who can connect to the database. All works well but there is an extra feature which has to pump and check bulk data into the database from a COM server. The COM server itself has the tendency to pop up occasional dialogs so it just has to run on a manned workstation. (Imagine a web server popping up a dialog. It will have to wait until someone will visit the server room and take a look at that particular screen. Could take weeks) A good way for the client side app to communicate with the database is a web service. The server-side code of the web service implementation can reach the database. The client side sends and receives XML datasets to and from the web service.
There are several ways to implement an asmx web service with Visual Studio
- Listen carefully to the story Christian Weyer has to tell and use his Contract First tool
- Create a new project and pick new web service
- Add a web service to the existing web site project. Right click the project and just pick it:

The latter works like a snap. After all a web service is not that much different from a web page. Both a a matter of request and response. In the case of a web page a bunch of HTML is returned, in the case of a web service a bunch of XML is returned. When you browse through the classes in the .NET framework which are used you will see great overlap. Both a web service project and a web site project are based on the System.Web.HttpApplication class (in global.asax)
Implementing a service this way has some big pro's
- It's deployed with the site itself. No extra steps needed. Simple setup.
- It uses the same web.config. No extra configuration required.
It could have some con's as well...
<update after reading and trying Dave's advise>
Dave's first point, rolling out on one and the same machine, is exactly what I want, just a backdoor for the site.
But the authentication is indeed the big con. When the site is using forms authentication the service will be using windows authentication as well. It is somewhat hilarious to see your site login screen pop up in VS. So it's not a good idea.
- Service is not autonomous. It's dependent from the site.
- When the site uses forms authetication it's gonna be at least a hell of a web.config
My next post will be on Christians Contract First tool.