如何在 webconfig 中设置绑定以在 RESTful WCF 服务中启用流式传输

发布于 2024-11-06 18:07:45 字数 263 浏览 4 评论 0原文

我有一个 RESTful 服务,我正在尝试启用该服务来接受 PDF 文件。我使用流来传输它,但在这个过程中我不断遇到神秘的错误。

我的第一个错误是这样的:安全协商失败,因为远程方没有及时发回回复。这可能是因为底层传输连接被中止。

不确定是什么原因造成的。另外,我尝试添加 customBinding 来尝试修复此错误,但收到一条错误消息,指出我的绑定设置不正确。

我的主要总体问题是: 有谁知道如何设置它以启用流媒体的简单绑定和完整说明?

I have a RESTful service which I'm trying to enable to accept a PDF file. I'm using a stream to transport it, but I keep running into mysterious errors in the process.

My first error is this: Security negotiation failed because the remote party did not send back a reply in a timely manner. This may be because the underlying transport connection was aborted.

Not sure what's causing that. Also, I tried adding a customBinding in an attempt to fix this error, and I get an error that says I don't have my binding set up properly.

My main, overall question is this:
Does anyone know of a simple binding and complete instructions for how to set it up to enable streaming?

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

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

发布评论

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

评论(1

你与昨日 2024-11-13 18:07:45

我设法让它工作。我发现我的问题不是我的绑定,而是它从未注册。这是 web.config 文件中的代码:

<services>
    <service name="ResearchUploadService.Service1" behaviorConfiguration="ResearchUploadService.Service1Behavior">
    <endpoint address="" binding="customBinding" bindingConfiguration="basicConfig" contract="ResearchUploadService.IService1"/>            
    </service>
</services>
...
<bindings>
    <customBinding>
        <binding name="basicConfig">
           <binaryMessageEncoding/>
           <httpTransport transferMode="Streamed" maxReceivedMessageSize="67108864"/>
        </binding>
     </customBinding>
</bindings>

I managed to get it working. I found that my problem wasn't my binding, but that it was never registered. Here's the code in the web.config file:

<services>
    <service name="ResearchUploadService.Service1" behaviorConfiguration="ResearchUploadService.Service1Behavior">
    <endpoint address="" binding="customBinding" bindingConfiguration="basicConfig" contract="ResearchUploadService.IService1"/>            
    </service>
</services>
...
<bindings>
    <customBinding>
        <binding name="basicConfig">
           <binaryMessageEncoding/>
           <httpTransport transferMode="Streamed" maxReceivedMessageSize="67108864"/>
        </binding>
     </customBinding>
</bindings>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文