WCF 4 REST 模板和 base64 字符串 - HTTP 400

发布于 2024-11-18 18:21:55 字数 1103 浏览 8 评论 0原文

我正在尝试使用 Microsoft 提供的 wcf 4 REST 模板将长(大约 155000 个字符)base64 字符串提交到 WCF REST 服务。每当我尝试通过 post 方法从客户端应用程序或 fiddler 提交 XML 时,我都会收到 HTTP 状态代码 400 作为对我的请求的响应。我有适当的 web.config 设置,这些设置是从各种博客文章和其他 stackoverflow 文章中拼凑而成的。

   <bindings>
      <webHttpBinding>
        <binding name="httpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"  openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00">
          <readerQuotas maxDepth="64"
                 maxStringContentLength="2147483647"
                 maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647"
                 maxNameTableCharCount="2147483647"/>
        </binding>
      </webHttpBinding>
    </bindings>  

我在这里缺少什么?其他一切都很好;我向服务提交 text/xml 格式的请求,只要我不使用 base64 字符串,其他所有内容都会返回 200。我知道还有一百万个关于 wcf 消息大小的其他帖子,但如果有人能快速浏览一下我的帖子,我将不胜感激。

这是我试图让 wcf 服务处理的示例请求的链接

我很感激任何人可能有的任何想法。

I am trying to submit a long (approx. 155000 characters) base64 string to a WCF REST service using the wcf 4 REST template made available by Microsoft. Whenever I try submitting the the the XML through the post method either from the client application or fiddler I get a HTTP status code 400 in response to my request. I have the appropriate web.config settings, pieced together from various blog posts and other stackoverflow posts.

   <bindings>
      <webHttpBinding>
        <binding name="httpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"  openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00">
          <readerQuotas maxDepth="64"
                 maxStringContentLength="2147483647"
                 maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647"
                 maxNameTableCharCount="2147483647"/>
        </binding>
      </webHttpBinding>
    </bindings>  

what am I missing here? Everything else works great; I submit requests that are text/xml format to the service and everything else returns 200, as long as I'm not working with the base64 string. I know there are a million other posts about wcf message size, but I would appreciate it somebody would take a quick look at mine.

Here is a link to the sample request I am trying to get the wcf service to handle.

I would appreciate any thoughts anybody might have.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原谅我要高飞 2024-11-25 18:21:55

尝试在服务器端启用跟踪以查看导致服务器拒绝请求的原因。另外,请仔细检查:

  • 您的服务的 元素具有值为“httpBinding”的 bindingConfiguration 属性
  • 服务的元素 name 属性,它与服务类的完全限定名称相匹配(即,使用命名空间,本质上与您在 .svc 文件中使用的值相同) )。

Try enabling tracing at the server side to see what is causing the server to reject the request. Also, double check that:

  • The <endpoint> element for your service has a bindingConfiguration attribute with value "httpBinding"
  • The <service> element for your service a name attribute which matches the fully-qualified name of the service class (i.e., with the namespace, essentially the same value you use in the .svc file).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文