【发布时间】:2015-06-13 03:52:30
【问题描述】:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name ="SaadiqinWcf.SaadiqinServiceBehavior">
<!-- 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="true"/>
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name ="jsonBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<services>
<service name="SaadiqinWcf.SaadiqinService" behaviorConfiguration="SaadiqinWcf.SaadiqinServiceBehavior">
<endpoint name ="SaadiqinEndPoint" address="**" binding="basicHttpBinding" bindingConfiguration="myBindingConfiguration" contract="**" />
<!-- <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="myBindingConfiguration" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="01:50:00" openTimeout="01:50:00" sendTimeout="01:50:00" receiveTimeout="01:50:00">
<readerQuotas maxDepth="128" maxStringContentLength="8388608"
maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<httpProtocol>
<customHeaders>
<add name ="Access-Control-Allow-Origin" value ="*"/>
</customHeaders>
</httpProtocol>
<directoryBrowse enabled="true"/>
</system.webServer>
<connectionStrings>
<add name="SaadiqinEntities" connectionString="data source=*****,***;initial catalog=***;persist security info=true;user id=***; Password=***; TrustServerCertificate=True; multipleactiveresultsets=True;application name=EntityFramework" />
</connectionStrings>
</configuration>
这是我的Web.config 文件。运行测试客户端时出现 WCF 错误。我也添加了绑定配置,但它仍然抛出同样的错误(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.)。
我已经将我的web.config 中的MaxReceivedMessageSize 属性设置为一个很大的值,我还使用上述配置在客户端本身的代码以及服务中设置了绑定但没有更改。
绑定是否正确?我需要添加其他内容还是需要删除某些内容。我很困惑。
注意:我正在从 WCF 测试客户端测试服务。
【问题讨论】:
标签: .net wcf configuration web-config