繁体   English   中英

如何为WCF Web角色配置消息大小(当前获得HTTP错误代码500)

[英]How to configure the message size for a WCF web role (Currently getting HTTP error code 500)

谢谢你们!

通过将绑定元素名称从“ basicHttpBinding”更改为“ webHttpBinding”,我们能够解决此问题。

傻,我知道..


你好,

我正在尝试使用WCF实施Web角色,该角色将接收JSON对象并将其存储在Azure存储中。 在集成测试中,我得到了400错误代码。 然后,我发现WCF的消息大小非常小(〜65535),我需要将其配置为更大。 每当我尝试将HTTP请求发布到服务时,我当前使用的配置都会导致500错误代码(该请求永远不会到达我的代码)。

我正在使用的Web.config文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>

  <system.web>

    <compilation debug="true" targetFramework="4.0" />

  </system.web>

  <system.serviceModel> 

    <diagnostics>

      <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxSizeOfMessageToLog="5000000" />

      <endToEndTracing activityTracing="false" />

    </diagnostics>

    <services>

      <service name="MyWebRole.RequestHandler" behaviorConfiguration="RequestHandlerbehavior">

        <endpoint address="http://localhost:9001/" binding="basicHttpBinding" bindingConfiguration="conf" name="MyDefaultEndpoint"

                                contract="MyWebRole.IRequestHandler" />

      </service>

    </services>   

    <bindings>

      <basicHttpBinding>

        <binding name="conf" maxBufferSize="5000000" maxReceivedMessageSize="5000000" useDefaultWebProxy="true">

          <readerQuotas maxDepth="5000000" maxStringContentLength="5000000" maxArrayLength="5000000" maxBytesPerRead="5000000" maxNameTableCharCount="5000000" />

        </binding>

      </basicHttpBinding>

    </bindings>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

    <behaviors>

      <serviceBehaviors>

        <behavior name="RequestHandlerbehavior">

          <serviceMetadata httpGetEnabled="true" />

          <serviceDebug includeExceptionDetailInFaults="true" />

        </behavior>

      </serviceBehaviors>

    </behaviors>

  </system.serviceModel>

  <system.webServer>

    <modules runAllManagedModulesForAllRequests="true" />

  </system.webServer>

</configuration>

您能帮我将请求发送到WCF服务吗?

谢谢!

您是否尝试过增加绑定上的邮件接收大小? 如...

maxReceivedMessageSize =“ 1048576”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM