2

我刚刚向 Azure 发布了一个使用 wsHttpBinding 的 WCF 服务。在开发环境中,我已经添加了服务引用就好了,但是在部署到 Azure 之后,服务引用没有生成代理类。我必须切换到 Web Reference 才能使代码生成正常工作。为什么?

这是我的配置文件:

    <?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>

谢谢。

4

1 回答 1

0

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

<behavior name="web"
   <webHttp />
</behavior>
于 2012-11-28T17:15:08.197 回答