【发布时间】:2020-12-15 12:32:31
【问题描述】:
这是我的配置文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="SharedFilePath" value="\\share\DocumentFiles" />
</appSettings>
<system.web>
<compilation targetFramework="4.6" />
<httpRuntime maxRequestLength="32768" executionTimeout="14400" targetFramework="4.6" requestLengthDiskThreshold="32768" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="GeneralBasicHttpBinding" maxReceivedMessageSize="2147483647" closeTimeout="0:15:00" openTimeout="0:15:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" transferMode="Streamed">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ServiceBehaviour" name="DocumentFiles.Service.Contract.Implementation.DocumentFilesImplementation">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="GeneralBasicHttpBinding" contract="DocumentFiles.Service.Contract.Operations.IDocumentFiles" />
<!--<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/>-->
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
<!--ProjectGuid: DD0CDEB9-DBFC-4ECA-837C-BAF09499A3FA-->
发布 5MB 的文件时会引发错误:运行配置文件中指定的扩展时出现异常。 ---> 超出最大请求长度。
但是当我将默认网站(托管服务的位置)的配置更改为使用 maxRequestLength="32768" 时,文件会正常发布。
我还需要做些什么才能让这仅适用于机器配置更新吗?
【问题讨论】: