简体   繁体   中英

Hosting WCF webservice in a subdirectory

Our organization has several WCF web services that need to be hosted as their own applications, but we would like to serve from a single subdomain.

webservs.domain.edu/service1/
webservs.domain.edu/service2/

The service1 and service2 subdirectories are setup as their own applications within the main (webservs) folder. The trouble is, because the subdirectories are their own applications (which is necessary because the services are all separate projects, with very different functions/codebases) they don't recognize the correct directory structure.

In the wsdl document, the schemaLocation is:

<xsd:import schemaLocation="http://server.department.domain.edu/service1/Service.svc?xsd=xsd0">

However, the correct path would be:

<xsd:import schemaLocation="http://server.department.domain.edu/webservs/service1/Service.svc?xsd=xsd0">

Someone suggested setting the serviceBehavior httpGetUrl attribute to the correct path, but when I do that, I get an exception thrown: 'A registration already exists for URI'.

Has anybody run into this issue or have any ideas on how to implement this?

You need to define each appropriate service as an application in IIS within the 'webservs' virtual directory (that is, nested beneath it). If you have done that already, you should be able to retrieve the wsdl by calling http://server.department.domain.edu/webservs/service1/Service.svc?wsdl

If this is working, but the schemaLocation is still wrong, check out this thread: http://forums.silverlight.net/t/20767.aspx/1

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