tags:

views:

306

answers:

1

hi,

I have 4 services running via a service host project, which communicate fine with my asp.net application when the ASP.NET development server hosts them through VS for debugging.

I am trying to deploy these to IIS on a windows server 2008 machine, using WAS.

I have the project set up as an application in IIS, and have copied the entire config section from app.config in servicehost project to web.config of the IIS site.

After a few compliation issues, I now get a directory listing when i navigate to http://localhost:8000/Services

I have also created a Service.svc file, which contains <%@ServiceHost Service=MyApp.AddressService %>

When I navigate to localhost:8000/Services/AddressService, I get a message that i've created a service, and appending ?wsdl gives me the xml to create a client.

Problem is, I get an error when I try to add any more services to the .svc file.

Should I be using service.svc to configure multiple services, or is there a different way using WAS? How can I expose my other three services through the same application?

Thank you!

A: 

You cannot add multiple service to a SVC file. One SVC file = one service class. No way to change that.

However: you can definitely implement multiple service interfaces on your service class:

public class YourService : IService1, IService2, IService3
{
  ... 
}

and then you have one SVC file = one service (implementation) class = 3 service contracts.

In .NET 4 / WCF 4, you'll be able to define URL's for service in your web.config, and you don't need the SVC files anymore.

See this blog post here or this one here for more info, if .NET 4 is an option for you.

marc_s