誰でもWCF構成について教えてもらえますか? エラー(400) Bad Requestが発生し、トレース ビューアーから次のように言われました:
「受信メッセージの最大メッセージ サイズ クォータ (65536) を超えました。クォータを増やすには、適切なバインド要素で MaxReceivedMessageSize プロパティを使用してください。」
クライアントのapp.configを見て、それに応じてプロパティを変更しましたが、問題は残っていました。次に、サーバーのweb.configを調べましたが、<service>...</service>
タグがまったくないことがわかったので、右クリックweb.config
してウィンドウを選択Edit WCF configuration
して数回クリックすると、wcf サービス構成の準備ができましたが、スローが開始されました
「サーバーは意味のある応答を提供しませんでした。これは、コントラクトの不一致、時期尚早のセッションのシャットダウン、または内部サーバー エラーが原因である可能性があります」
トレース ビューアに 3 つの警告が表示されます。
「System.ServiceModel.ServiceHost を開けませんでした」
「障害が発生した System.ServiceModel.ServiceHost」
「ServiceHost に障害が発生しました」
これが私のサーバーのweb.configです:
バージョン 0 (機能しますが、制限があります):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces1.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<connectionStrings>
<add name="PopulizerConnectionString" connectionString="Data Source=VM-LU4\SQLSERVER;Initial Catalog=Populizer;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
そして、3 つの警告を示すもの:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces1.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<connectionStrings>
<add name="PopulizerConnectionString" connectionString="Data Source=VM-LU4\SQLSERVER;Initial Catalog=Populizer;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<services>
<service name="NewServiceType">
<host>
<baseAddresses>
<add baseAddress="http://localhost:1948/Commander.svc" />
</baseAddresses>
</host>
</service>
<service name="Populator.Commander">
<endpoint address="http://localhost:1948/Commander.svc" binding="basicHttpBinding"
bindingConfiguration="" name="CommanderEndpoint" contract="Private.ICommander" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
編集
これは私の Web 構成のバージョン #3 ですが、TraceViewer で同じ 3 つの警告が引き続き表示されます。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<connectionStrings>
<add name="PopulizerConnectionString" connectionString="Data Source=VM-LU4\SQLSERVER;Initial Catalog=Populizer;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="httpBasicBinding_Service01" closeTimeout="00:10:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
maxBufferSize="655360000"
maxBufferPoolSize="655360000" maxReceivedMessageSize="655360000">
<readerQuotas maxDepth="655360000" maxStringContentLength="655360000"
maxArrayLength="655360000" maxBytesPerRead="655360000" maxNameTableCharCount="655360000" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="NewServiceType">
<host>
<baseAddresses>
<add baseAddress="http://localhost:1948/Commander.svc" />
</baseAddresses>
</host>
</service>
<service name="Populator.Commander">
<endpoint address="http://localhost:1948/Commander.svc" binding="basicHttpBinding"
bindingConfiguration="httpBasicBinding_Service01" name="CommanderEndpoint" contract="Private.ICommander" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>