WCF URL 问题

标签 wcf azure wcf-binding

我对网络开发有点陌生,所以我不确定这里使用的术语。我有一个为 windows azure 构建的 wcf Web 服务。我希望有多个端点解析到同一服务,但我不完全确定如何配置它。

这可能有助于更好地解释我想要的东西:

目前,我有一个服务: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>

它仍然无法工作,但希望它已经接近了。希望有任何建议!

最佳答案

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

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

关于WCF URL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4390693/

相关文章:

wcf - Azure 服务总线中继 - 从本地获取数据

python - Azure Databricks python 命令显示当前集群配置

c# - 如何向 ICommand 对象添加键盘快捷键

silverlight - Silverlight 的 Wcf 配置

wcf - 有没有监控WCF队列的工具?

c# - 如何使用我得到的 WSDL 文件?

azure - 我的托管集群 VirtualMachineScaleSet 中的 vmssCSE 扩展是什么?

azure - 我可以通过ARM模板申请权限吗?

node.js - NPM-node-soap 支持 WsHttpBinding 吗?