3

これについて投稿して申し訳ありませんが、それは私を狂わせています。VS2010のWCF4RESTテンプレートでルートを使用しています。maxreceivedmessagesizeプロパティを巨大な数値に設定しましたが、xmlをサービスに送信しようとするとHTTPステータスコード400が表示されます。トレースをオンにしたところ、メッセージには、デフォルトのメッセージサイズに設定されたままであることが示されています。これにより、問題はweb.configの設定方法の微妙な違いにあると思います。誰かがそれをすぐにピークにして、彼らがどう思うか教えてもらえますか?

私はこれを何度も繰り返してきました、そして余分な目のセットは私にとって大きな利益になるでしょう。前もって感謝します!

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
  </system.webServer>

  <system.serviceModel>

    <bindings>
      <webHttpBinding>
        <binding name="" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"  openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00" maxBufferSize="2147483647">
          <readerQuotas maxDepth="64"
                 maxStringContentLength="2147483647"
                 maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647"
                 maxNameTableCharCount="2147483647"/>
        </binding>
      </webHttpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <dataContractSerializer maxItemsInObjectGraph="9000000"/>

          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>


    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    <standardEndpoints>
      <webHttpEndpoint>
        <!-- 
            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint 
            via the attributes on the <standardEndpoint> element below
        -->
        <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" maxReceivedMessageSize="2147483647" transferMode="Streamed" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"/>
      </webHttpEndpoint>
    </standardEndpoints>
  </system.serviceModel>

  <system.diagnostics>
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="traceListener"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\logs\Traces.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

</configuration>
4

2 に答える 2

0

わかりました。問題は実際にはクライアントにありました。http 投稿で送信しようとしていたオブジェクトをシリアル化していませんでした。テスト サーバー上のサービスに対してチェックしたところ、投稿の xml を修正したところ、適切に機能するようになりました。ありがとう!

于 2011-07-11T13:19:45.037 に答える
0

OperationContract 属性はどのように見えますか? RequestFormat と ResponseFormat を WebMessageFormat.Xml に設定しましたか? また、BodyStyle は WebMessageBodyStyle.WrappedRequest である必要があります

エントリがないので、IIS で実行していると思います。その場合は、適切に構成された .svc ファイルがあることを確認してください。

また、global.asax を調べて、URL が実際に wcf サービスを指していることを確認してください。私はただ推測していますが、そうではないことを確信しているのは、メッセージサイズのプロパティです

于 2011-07-08T19:42:32.577 に答える