我有一个连接到数据服务的移动应用程序,当通过表单身份验证连接到数据服务时,可以毫无问题地上传大文件。当我将身份验证更改为使用基本身份验证时,只会上传最小的文件。无论身份验证模式如何,web.config中的所有“最大”数字都被最大化。
为什么基本身份验证甚至不允许上传800kb?
我认为这是web.config的重要部分:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967295" maxUrl="4294967295" maxQueryString="4294967295" />
</requestFiltering>
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="true" />
</authentication>
</security>
...
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="httpBasicBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" closeTimeout="10:01:00" sendTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="httpsBasicBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" closeTimeout="10:01:00" sendTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="httpWebBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" closeTimeout="10:01:00" sendTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="httpsWebBinding" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" closeTimeout="10:01:00" sendTimeout="10:01:00" openTimeout="10:01:00" receiveTimeout="10:10:00">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="httpBasicBinding" />
<add scheme="https" binding="webHttpBinding" bindingConfiguration="httpsBasicBinding" />
</protocolMapping>
</system.serviceModel>
在对设置进行更多调整之后,可以获得更多信息: 我启用了此操作无济于事:
<serverRuntime uploadReadAheadSize="2147483647" />
使用应用模拟器,我可以收到以下错误消息: 413(请求实体太大)
我已经尝试过在此错误消息中可以找到的所有解决方案,但仍然没有运气。