2

wsHttpBinding を使用する WCF サービスを Azure に公開しました。開発環境では、サービス リファレンスを問題なく追加しましたが、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>

ありがとう。

4

1 に答える 1

0

この behaviourConfiguration をエンドポイントに追加します

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