【问题标题】:Azure web service URL issueAzure Web 服务 URL 问题
【发布时间】:2012-01-01 18:03:22
【问题描述】:

我写了一个简单的 webget 服务,在 web.config 中添加了这段代码。

然后为了访问它,我必须输入 http://127.0.0.1/service1.svc/data?value=4

我搜索了所有配置文件,但找不到如何摆脱 service1.svc 部分..

  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="webby">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors" >
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service name="WCFServiceWebRole1.Service1" behaviorConfiguration="MyServiceTypeBehaviors">
        <endpoint
          address="/"
          binding="webHttpBinding"
          contract="WCFServiceWebRole1.IService1"
          behaviorConfiguration="webby"/>
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

【问题讨论】:

    标签: wcf rest azure


    【解决方案1】:

    如果你在 Azure 上,你很可能在 IIS 上托管。

    这篇文章:http://social.technet.microsoft.com/wiki/contents/articles/hosting-a-wcf-rest-service-on-iis.aspx 很好地解释了如何使用 ASP.NET 路由将Service1.svc 的请求重新路由到您的服务。

    【讨论】:

    • 微软把它弄得太复杂了!
    • 现在那里我同意。不过,WCF Web API(在 CTP 中)确实让这有点整洁。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-07
    相关资源
    最近更新 更多