listenURI for .svc service

I have a service athttp://localhost/service.svc I can access this service through the browser and get my Xml back.

However, I wish to actually have this service seen by the client ashttp://localhost/service (soon i will havehttp://localhost/service/A ,http://localhost/service/B and so on)

Can i do this - it is hosted in IIS? Can i map the logical "service" to the physical "service.svc" ?

I really just want to avoid people actually *seeing* the file extensions.

steven

http://livz.org

[921 byte] By [weblivz] at [2008-1-8]
# 1

FWIW, you can achieve this by using a directory for each service you wish to expose, adding a default.svc document and making this a default document in IIS.

So, create a directory at http://domain/api/myservice.dowork

Put a default.svc in there - so this resolves to http://domain/api/myservice.dowork/default,svc

Make your URI template "?name=value".

You can now expose your services as : http://domain/api/myservice.dowork?name=value

Much nicer and not really any hacks.

steven

http://livz.org

weblivz at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 2

Hi Seven,

As a possible solution to your question, you might want to look into providing different address values in the endpoint definition within in the web.config file for the services. By doing this, you can provide a URL with a common virtual directory and services being uniquely defined. (Refer to the WCF Overview for more information.)

As a quick example, let's say you have the URL http://localhost/service/ and in that virtual directory you have two different services defined and named A and B, respectively. When you define the endpoint address for each service in the web.config file (which will also live in that same virtual directory), make sure you add the specific value for the address you want to use. In other words, for service A your endpoint address will look something like:

<endpoint address="A" binding="wsHttpBinding" contrace="IMyContractForServiceA" />

Siminlarly, for service B, your endpoint address will look something like:

<endpoint address="B" binding="wsHttpBinding" contrace="IMyContractForServiceB" />

Then, when your client is to use service A, have it connect to http://localhost/service/service.svc/A.

Hope this helps,

Richie

SDET, WCF

RichieWeldon at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 3

Hi Richie - it definitelty helps in something else i was wondering, so thanks Smile

Where you have http://localhost/services/service.svc/A , i want http://localhost/services/service/A

Subtle, but i don't want the ".svc" in there - i LOVE the flickr REST API as i thnk it is the easiest on the web to follow. It actually extends from an API to a generic technique users can put in their browser easily - not file extensions to think of.

If you check most REST API's they remove the technology behind from the API - this is something that i believe works well and why for example, every web site i have written in the recent past while have always used the redirect as "domain.com/user/87843" rather than "domain.com/user.aspx?pid=87843". Removing file extensions etc is a big part of that.... i just don't wanna have to map the IIS wildcard to SVC if that is needed....

regards,

steven

http://livz.org

Sorry for the below, but my 4 year old has been hassling me during this post to "type something"....

xavier esddfffsxxcxxxxcxxsxdzzxxcxc c

weblivz at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 4

Hi Steven,

Unfortunately In WCF, you are not able to have web hosted services without the .svc extension. Sad This concept is possible, however, if you have a self hosted service (meaning you the developer and IT admin control the life of the service, not IIS.)


Best regards,

Richie

SDET, WCF

RichieWeldon at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...
# 5

Thanks again Richie - yes, the self hosted version is something i have considered, but IIS is so powerful for all the other stuff that i think i will stick with it.

As I said above, I can kind of get what i want by using a directory and a default.svc to give me http://domain/service?a=b - this is good enough for just now.

Best Wishes,

Steven

http://livz.org

weblivz at 2007-10-2 > top of Msdn Tech,Visual Studio Orcas,Windows Communication Foundation (Indigo)...

Visual Studio Orcas

Site Classified