开发者

Fail to define new endpoint on basicHttpBinding

I want to define two en开发者_C百科dpoint that will represent two different interfaces

<services>
  <service behaviorConfiguration="ServiceBehavior" >
    <endpoint 
        binding="basicHttpBinding" 
        bindingConfiguration="LargeData_basicHttpBinding" 
        contract="Contracts.IService1" />
    <endpoint 
        binding="basicHttpBinding" 
        bindingConfiguration="LargeData_basicHttpBinding" 
        contract="Contracts.IService2" />
    <endpoint 
        address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" />
  </service>
</services>

When I try to add the second endpoint for IService2, I can access only the service2 from the browser - and if I remove the service2 from the config file - I can access from the browser to service1 && service2.

What is my mistake ?


You're not specifying any local/relative addresses for the endpoints! Therefore, they're both using the same base address / location of your virtual directory.

Try specifying a relative address for both:

<endpoint 
    address="Service1"
    binding="basicHttpBinding" 
    bindingConfiguration="LargeData_basicHttpBinding" 
    contract="Contracts.IService1" />
<endpoint 
    address="Service2"
    binding="basicHttpBinding" 
    bindingConfiguration="LargeData_basicHttpBinding" 
    contract="Contracts.IService2" />

Now you should be able to access both services, one at

http://yourserver/virtualdirectory/YourService.svc/Service1

and the other at

http://yourserver/virtualdirectory/YourService.svc/Service2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜