0

Question Edited for better understanding:

I have a WCF service and any of my links look like :

https://192.168.1.31/ContactLibrary2.0HTTPS/Service.svc/..... .

I want to get rid of the Service.svc. I installed URL Writer in IIS but i don't know how to work with it. I search a little bit and didn't find anything to help me with this particular problem.

Any idea ?
4

1 に答える 1

1

Assuming you are configuring the application hosted at /ContactLibrary2.0HTTPS directly (and not the website containing that directory, for example), you may add an exact match for:

rest/GetContact

with a rewrite url of:

Service.svc/rest/GetContact

Perhaps you wish to rewrite every action of Service.svc, however; then you would need a regular expression match for:

^rest/.*$

with a rewrite url of:

Service.svc/{R:0}

UPDATE

Assuming you also need to remove that string from the urls of your HTML pages, you would need to couple the aforementioned inbound rule with a new outbound rule, applied to the files you are interested in.

To do that, please:

  1. add a new outbound rule to your website and give it a name;
  2. add a new precondition with two rules (matching any of them):
    • {RESPONSE_CONTENT_TYPE} matches text/html
    • {RESPONSE_CONTENT_TYPE} matches application/xhtml+xmll
  3. configure the rule to match the response scope, matching the content within A tags:
    • should match the pattern using a regular expression;
    • with this pattern: ^(.*)(/Service\.svc/)(.*)$
    • case insensitive;
  4. configure the action to be a rewrite, with this value: {R:1}{R:3}
于 2012-04-10T08:27:14.587 に答える