无法在Azure上使用wsHttpBinding添加对服务的引用

时间:2012-11-25 19:39:29

标签: wcf azure

我刚刚发布了一个使用wsHttpBinding到Azure的WCF服务。在开发环境中,我已经添加了服务引用,但在部署到Azure之后,服务引用没有生成代理类。我不得不切换到Web引用以使代码生成工作。为什么呢?

这是我的配置文件:

    <?xml version="1.0"?>
<configuration>
  <system.diagnostics>
<trace>
  <listeners>
    <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      name="AzureDiagnostics">
      <filter type="" />
    </add>
  </listeners>
</trace>
  </system.diagnostics>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <services>
      <service name="MyService.DataSync">
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:57059"/>
            <add baseAddress="http://xxxxxxxxxxx.cloudapp.net"/>
          </baseAddresses>
        </host>
        <endpoint address=""
          binding="wsHttpBinding" bindingConfiguration="" name="SvcEndpoint"
          contract="MyLibrary.IDataSync" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <connectionStrings>
    <add name="db" connectionString="...."/>
  </connectionStrings>
</configuration>

感谢。

1 个答案:

答案 0 :(得分:0)

将此行为配置添加到您的终端

<behavior name="web"
   <webHttp />
</behavior>