简体   繁体   中英

Asp.Net wcf service endpoint

I have a set of services in an asp.net service project. I have configured the endpoints for them in web.config.

This is how I setup the endpoints in web.config:

<bindings>
  <basicHttpBinding>
    <binding name="GeneralBindingConfig" maxBufferSize="524288" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600">
      <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None" />
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="TeamTravel.Cloud.Services.ServiceContracts.AccountServices">
    <endpoint address="/Services" binding="basicHttpBinding" bindingConfiguration="GeneralBindingConfig" contract="TeamTravel.Cloud.Services.ServiceContracts.Interfaces.IAccountServices" />
  </service>
  <service name="TeamTravel.Cloud.Services.ServiceContracts.JourneyServices">
    <endpoint address="/Services" binding="basicHttpBinding" bindingConfiguration="GeneralBindingConfig" contract="TeamTravel.Cloud.Services.ServiceContracts.Interfaces.IJourneyServices" />
  </service>
  <service name="TeamTravel.Cloud.Services.ServiceContracts.JourneyTrackerServices">
    <endpoint address="/Services" binding="basicHttpBinding" bindingConfiguration="GeneralBindingConfig" contract="TeamTravel.Cloud.Services.ServiceContracts.Interfaces.IJourneyTrackerServices" />
  </service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

In IIS i mounted the website under this binding: www.teamtravel.com I also added the entry in my hosts file so that I can access the website locally from that url.

So based on the configuration I should be able to access a service like this:

www.teamtravel.com/Services/AccountServices.svc

AccountServices.svc are asp.net wcf services.

But I get redirected to an error path:

http://teamtravel.com/default.aspx?aspxerrorpath=/Services/AccountServices.svc

When hosting WCF service on IIS, the virtual directory where your service exists defines your service endpoint's address, so you can just leave this property empty:

<endpoint address="" ... />

And you service will be reachable from www.teamtravel.com/<YourIISVirtualDirectory>/AccountServices.svc .

Address property may be used to add endpoints with addresses relative to that address:

<endpoint address="anotherEndpoint" .../>

so this endpoint will be reachable from www.teamtravel.com/<YourIISVirtualDirectory>/AccountServices.svc/anotherEndpoint

For reference, read Deploying an Internet Information Services-Hosted WCF Service from MSDN.

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