首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >wcf上传流-远程服务器返回了一个意外的响应:(400)坏请求

wcf上传流-远程服务器返回了一个意外的响应:(400)坏请求
EN

Stack Overflow用户
提问于 2013-01-29 13:21:53
回答 1查看 2K关注 0票数 1

我调查了许多类似的问题,但我无法解决我的问题!

我正在尝试发送一个XML文件到服务器,并通过一个函数作为XML文件获得响应。

我可以发送高达48 am的XML文件,但不能发送更大的文件!

在开发web服务和客户端时,我使用了此链接

此外,我对ISS设置做了如下更改:

代码语言:javascript
复制
cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 10485760

appcmd.exe set config "Default Web Site" -section:system.webServer/serverRuntime /uploadReadAheadSize:"10485760"  /commit:apphost

我在服务<httpRuntime targetFramework="4.5" maxRequestLength="10485760" useFullyQualifiedRedirectUrl="true" executionTimeout="36000"/>文件中添加了web.config

和客户端app.config文件中的app.config

我在服务的web.config文件中实现了绑定和服务配置,如下所示:

代码语言:javascript
复制
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService" closeTimeout="10:01:00"
      openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00"
      maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
      transferMode="Streamed" messageEncoding="Text">
      <readerQuotas maxDepth="128" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service name="Service">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
      contract="IService" />
  </service>
</services>

在App.config中的客户端配置中:

代码语言:javascript
复制
<bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService" closeTimeout="10:01:00"
                openTimeout="10:01:00" receiveTimeout="10:10:00" sendTimeout="10:01:00"
                maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
                maxReceivedMessageSize="2147483647" transferMode="Streamed"
                messageEncoding="Text">
                <readerQuotas maxDepth="128" maxStringContentLength="2147483647"
                    maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
            </binding>
            <binding name="BasicHttpsBinding_IService">
                <security mode="Transport" />
            </binding>
        </basicHttpBinding>
    </bindings>

你知道为什么我不能发送一个大小大于48 is的文件吗?

EN

回答 1

Stack Overflow用户

发布于 2013-01-30 12:12:36

我在web.cofing文件中添加了下面的代码,问题解决了:D

代码语言:javascript
复制
  <protocolMapping>
  <add binding="basicHttpBinding" scheme="http" bindingConfiguration="BasicHttpBinding_IService"/>
</protocolMapping>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14583936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档