无法通过webservice上传超过1MB的文件



可以看看我的网页吗?配置并告诉我有什么问题?我只是无法通过远程网络服务上传大于1MB的文件。我猜这与属性设置有关,但到目前为止,我还没有运气改变值。还是主机服务器端的设置无法重写?

     <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="CategoryPath" value="QA/ProcessValidation"/>
      </appSettings>
      <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
      </startup>
      <system.serviceModel>
        <bindings>
          <basicHttpBinding>
            <binding name="BasicHttpBinding_Authentication" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                <message clientCredentialType="UserName" algorithmSuite="Default"/>
              </security>
            </binding>
            <binding name="BasicHttpBinding_DocumentManagement" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                <message clientCredentialType="UserName" algorithmSuite="Default"/>
              </security>
            </binding>
            <binding name="BasicHttpBinding_ContentService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                <message clientCredentialType="UserName" algorithmSuite="Default"/>
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <client>
        </client>
      </system.serviceModel>
      <system.web>
        <compilation debug="true"/>
      </system.web>
    </configuration>

编辑:我无法控制服务器端的服务,我实际上只使用WCF,我只有到它们的链接。

不完全清楚你发布的配置文件是客户端配置还是服务器配置,但我要做一个半教育的猜测,说它是客户端配置,你正在使用你的客户端连接到第三方服务。

如果你不知道你看到的错误信息和/或行为,或者你是如何在代码中创建客户端的,你可以尝试以下几件事:

  1. 增加<readerQuotas>元素中maxStringContentLength属性的大小。现在它被设置为默认的8,192字节。
  2. 如果这是服务配置,增加<binding>元素中的maxReceivedMessageSize属性-现在它也被设置为默认的65536。

这两个属性的最大值是Int32.MaxValue——大约2GB。在任何一种情况下,除非您在配置文件中指定了引用已定义的绑定配置(通过<endpoint>元素的bindingConfiguration属性)的端点(目前似乎没有),否则您将始终获得端点绑定的默认值。

因此,您需要将绑定定义作为默认值(通过从<binding>元素中省略name属性),或者您需要在端点上使用bindingConfiguration属性来分配您想要使用的绑定配置,如下所示:
<endpoint address="" binding=basicHttpBinding"
          bindingConfiguration="MyBinding" contract="MyService.IMyService" />

如果服务不在你的控制之下,那么如果它们设置了低限制,你将无法做很多事情,因为客户端不能修改服务的配置(服务也不能修改客户端的配置)。配置是独立的,但许多部分(绑定、安全等)必须匹配。

如果以上没有帮助,请编辑您的问题以添加更多信息(您看到的错误消息/行为,是客户端还是服务配置,您如何创建客户端,您是否有服务配置等)。

最新更新