WCF URL问题

时间:2010-12-08 17:58:38

标签: wcf azure wcf-binding

我对网络开发有些新意,所以我不确定这里使用的术语。我有一个wcf web服务,我为windows azure构建。我想有多个端点可以解析为同一个服务,但是我不完全确定如何配置它。

这可能有助于解释我想要的更好一点:

目前,我在https://myapp.cloudapp.net/service.svc

提供服务

我想将以下网址指向应用程序中的相同服务:

https://myapp.cloudapp.net/myapp/service.svc

我确信这很容易做到,我还没有找到解决方案。

编辑:

我在MSDN上找到了这个文档:

http://msdn.microsoft.com/en-us/library/ms734786.aspx

然而,我似乎无法让它发挥作用。

以下是我在web.config中定义端点的方法:

<services>
   <service behaviorConfiguration="MetadataEnabled" name="myProject.myApp.myService">
    <host>
      <baseAddresses>
        <add baseAddress="https://localhost/myService/" />
      </baseAddresses>
    </host>
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsBinding" name="wsBase" contract="myProj.myApp.IServ" />
    <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="mexBinding" name="HttpMetadata" contract="IMetadataExchange" />
    <endpoint address="myApp/" binding="wsHttpBinding" bindingConfiguration="wsBinding" name="WsPlain" contract="myProj.myApp.IServ" />
  </service>
</services>

它仍然没有用,但希望它越来越近了。会喜欢任何建议!

3 个答案:

答案 0 :(得分:1)

我刚刚找到了答案。我只需要在项目“myApp”中创建一个文件夹,然后将.svc文件(而不是.svc.cs文件)复制到该文件夹​​。这允许以下工作:

myapp.cloudapp.net/service.svc myapp.cloudapp.net/myapp/service.svc

答案 1 :(得分:0)

WCF Routing Service可能有用(或可能有点矫枉过正)。

另请参阅Supporting Multiple IIS Site BindingsEndpoint Addresses

答案 2 :(得分:0)

这很简单,你可能已经这样做了,但是你在ServiceDefinition.csdef中定义了InputEndpoints吗?