views:

237

answers:

2

What is best practice for naming & hosting a WCF service endpoint in IIS?

Assuming an example scenario of:

  • A service dealing with customer entities
  • A solution namespace of Company.Entities.Customer
  • Company.Entities.Customer.ServiceHost contains the IIS Host (ie. just the .svc file)
  • Company.Entities.Customer.Service contains the service implementation (not the hosting)
  • Company.Entities.Customer.ServiceContracts contains the service contracts

What would you name:

  • a) the virtual directory/website in IIS?
  • b) the .svc file?

As examples i am currently tossing up between:

+1  A: 

This being a subjective question, this is a subjective answer:

Personally I preffer a modified version of your second one presented. I sometimes use a sub domain (ws.alexdrenea.eu/Service1) and sometimes just use a virtual directory on the main site (alexdrenea.eu/Service1) with the svc being directly in that folder.

You can name the svc file as you wish but make sure you add it to the default pages in IIS so it can be accessible directly.

AlexDrenea
A: 

I definitely prefer your cleaner suggestion, #2. It gives you shorter URL's, still has all the relevant info (which customer you're dealing with).

Suggestion #1 is okay because it's very clear and leaves no doubt about what you're dealing with, but it seems overly complicated, too long and gives you too much chances for a typo :-)

Go with #2 if you ask me!

Marc

marc_s