私はこの問題で私の頭を壊しているのを助けてくれることを願っています。また、Googleを使用して無駄に。タイトルは私が私の受信メッセージの最大メッセージサイズの問題を持っている通りWCF着信メッセージ(65536)の最大メッセージサイズのクォータを超えました
Wcf-The maximum message size quota for incoming messages (65536) has been exceeded?
WCF, The maximum message size quota for incoming messages (65536) has been exceeded
The maximum message size quota for incoming messages (65536) has been exceeded
:他の多くの間。私はデフォルトのメッセージサイズをオーバーライドしようとしていますが、何を試みてもうまくいかず、受け取ったエラーがApp.configファイル内の私のカスタム設定を指している傾向があります。
私はWCFサービスホスト/ WCFテストクライアントとVisual Studio 2017 Professionalを使用しています。私のクライアントプロジェクトは、より広いWPF MVVMプロジェクト用のクラスライブラリです。私はWCFサービスをテストサーバー2012/IISにインストールしていないのですが、これは開発環境では有効ですか?
他のすべてのサービスをデフォルト設定のままにして、AirplaneServiceの最大メッセージサイズを増やそうとしています。私は私が大きなメッセージを受信したくないので、私は唯一のクライアント側のapp.configを変更する必要があると考えてい
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /></startup><system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IAirplaneService" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
<binding name="BasicHttpBinding_ILicenceService" />
<binding name="BasicHttpBinding_ICustomerService" />
<binding name="BasicHttpBinding_IMembershipService" />
<binding name="BasicHttpBinding_IPrefixService" />
<binding name="BasicHttpBinding_ICountryService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/AirplaneService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAirplaneService"
contract="AirplaneService.IAirplaneService" name="BasicHttpBinding_IAirplaneService" />
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/LicenceService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ILicenceService"
contract="LicenceService.ILicenceService" name="BasicHttpBinding_ILicenceService" />
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/CustomerService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICustomerService"
contract="CustomerService.ICustomerService" name="BasicHttpBinding_ICustomerService" />
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/MembershipService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMembershipService"
contract="MembershipService.IMembershipService" name="BasicHttpBinding_IMembershipService" />
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/PrefixService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPrefixService"
contract="PrefixService.IPrefixService" name="BasicHttpBinding_IPrefixService" />
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/CountryService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICountryService"
contract="CountryService.ICountryService" name="BasicHttpBinding_ICountryService" />
</client>
</system.serviceModel>
</configuration>
:私は私のクラスライブラリのクライアントを持っている
私のクライアント側のapp.configサービス側。しかし、完全を期すために、私はまた私のサービスはapp.configに関連するバインディングを追加しました:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="FlightSchoolEntities" connectionString="metadata=res://*/FlightSchoolModel.csdl|res://*/FlightSchoolModel.ssdl|res://*/FlightSchoolModel.msl;provider=System.Data.SqlClient;provider connection string="data source=xx.xx.xx.xx;initial catalog=FlightSchool;persist security info=True;user id=sa;password=xxxxxxxxxxxx;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="myBasicBinding" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Flight_School.Service.CountryService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/CountryService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="Flight_School.Service.ICountryService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Flight_School.Service.PrefixService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/PrefixService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="Flight_School.Service.IPrefixService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Flight_School.Service.MembershipService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/MembershipService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="Flight_School.Service.IMembershipService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Flight_School.Service.CustomerService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/CustomerService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="Flight_School.Service.ICustomerService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Flight_School.Service.LicenceService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/LicenceService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="Flight_School.Service.ILicenceService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
<service name="Flight_School.Service.AirplaneService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/AirplaneService/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="myBasicBinding" contract="Flight_School.Service.IAirplaneService">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="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="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
が、これは私が次のエラーが表示され実行:
System.ServiceModel.CommunicationException: 'The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.'
エラーが発生したコードのスニペット:
を using (AirplaneService.AirplaneServiceClient service = new AirplaneService.AirplaneServiceClient())
{
List<AirplaneService.Manufacturer> manufacturers = service.GetManufacturers();
結果をservice-> GetManufacturers()に限定すると、期待通りに製造元の一覧が返されます。
サービスを再実行するたびに、WCFテストクライアントで設定を変更する必要がありますが、実行してもプロジェクトを実行するときに同じエラーが表示されます。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IAirplaneService" sendTimeout="00:05:00"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8733/Design_Time_Addresses/Flight_School.Service/AirplaneService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAirplaneService"
contract="IAirplaneService" name="BasicHttpBinding_IAirplaneService" />
</client>
</system.serviceModel>
</configuration>
あなたのお手伝いが大変ありがとうございます。
リチャード。
私のクラスライブラリのクライアントにあるApp.Configあなたの設定は、ライブラリではなく実行中のプロジェクト(Client.exe、Server.exe)になければなりません。 – Rabban
ラブバンありがとう、私は一日中オンとオフになっていたに違いないが、明白な気がしなかったためにこれを主演していた!カスタムバインド設定を自分の.exeプロジェクトのApp.configファイルに追加して、期待どおりに動作します。私は最初のサービスバインディングを同じApp.configファイルに1週間前に追加したので、脳が衰えたはずです。もう一度ありがとう。 –