简体   繁体   中英

Call WCF service without .svc file name

Is there any setting that can allow me to access the WCF service instead of using

http://192.168.0.28/SampleArticle/RestService.svc/authorize

change to

http://192.168.0.28/SampleArticle/authorize

without added the RestService.svc reference name in the URL.

You can try to use URL Rewrite Module of IIS. You may refer the MSDN [blog]: https://blogs.msdn.microsoft.com/endpoint/2008/08/22/rest-in-wcf-part-ix-controlling-the-uri/ .

Updated: You may try something below to replace the entire RestService.svc from the URL.

<system.webServer>
    <rewrite>
        <rules>
            <rule name="RemoveRestService" stopProcessing="true">
                <match url="^(.*)/(RestService.svc)/(.*)" />
                <action type="Rewrite" url="{R:1}/{R:3}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM