.net 如何为WCF web角色配置消息大小(当前获取HTTP错误代码500)

.net 如何为WCF web角色配置消息大小(当前获取HTTP错误代码500),.net,wcf,azure,.net,Wcf,Azure,谢谢大家! 我们只需将绑定元素名称从basicHttpBinding更改为webHttpBinding,就可以解决这个问题 傻,我知道 你好, 我正在尝试使用WCF实现一个web角色,该角色将接收JSON对象并将它们存储在Azure存储中。在集成测试期间,我得到了400个错误代码。然后我发现WCF的消息大小非常小,约为65535,需要将其配置为更大。我当前使用的配置会导致一个500错误代码,每当我试图将HTTP请求发布到我的服务时,该请求永远不会到达我的代码 我使用的Web.config文件如下

谢谢大家!

我们只需将绑定元素名称从basicHttpBinding更改为webHttpBinding,就可以解决这个问题

傻,我知道

你好,

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

我使用的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

能否用准确的错误消息更新您的问题?您可能可以在服务器上的事件日志中找到它?有更密集的序列化程序。。。这将在一定程度上减少有效载荷。