请求太大时无法访问端点 (30 Mb +)
endpoint not reachable when request is too large (30 Mb +)
我正在尝试通过 MVC 和 WCF 上传文件。
我的 web.config MVC 项目配置为接收大文件。
<binding name="BasicHttpBinding_IFile" closeTimeout="00:30:00"
openTimeout="00:30:00" sendTimeout="00:30:00" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Mtom" />
当我调用我的 WCF 时出现问题。端点在 MVC 项目上,WCF 上的 web.config 具有此绑定:
<basicHttpBinding>
<binding name="FileUploadServiceBinding"
transferMode="Streamed"
messageEncoding="Mtom"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
receiveTimeout="00:30:00"
openTimeout="00:30:00"
closeTimeout="00:30:00"
sendTimeout="00:30:00">
<security mode="None">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxDepth="100"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
我正在发送 25Mb 的文件并且可以正常工作,但是当我尝试上传 30Mb 或更大的文件时,我的项目无法访问该服务,并抛出此错误消息:
"There was no listening endpoint at http://localhost:55010/FileService.svc able to accept the message." 这通常是由不正确的 SOAP 地址或操作引起的。获取更多详细信息。 “
谢谢!
如果您在 IIS Express 或 IIS 中托管您的服务,请求过滤模块的 maxAllowedContentLength
的默认值可能会妨碍(默认情况下为 30000000)。
尝试通过在 web.config 文件中添加如下内容来增加它:
<system.webServer>
<security>
<requestFiltering >
<requestLimits maxAllowedContentLength="52428800" />
<requestFiltering>
</security>
</system.webServer>
我使用以下行解决了服务器 web.config 上的问题:
<httpRuntime targetFramework="4.5" enableVersionHeader="false" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
现在我的问题是 System.OutOfMemoryException 当我试图将我的流复制到内存流时,但它不在 post 范围内。
谢谢大家!
我正在尝试通过 MVC 和 WCF 上传文件。
我的 web.config MVC 项目配置为接收大文件。
<binding name="BasicHttpBinding_IFile" closeTimeout="00:30:00"
openTimeout="00:30:00" sendTimeout="00:30:00" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" messageEncoding="Mtom" />
当我调用我的 WCF 时出现问题。端点在 MVC 项目上,WCF 上的 web.config 具有此绑定:
<basicHttpBinding>
<binding name="FileUploadServiceBinding"
transferMode="Streamed"
messageEncoding="Mtom"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
receiveTimeout="00:30:00"
openTimeout="00:30:00"
closeTimeout="00:30:00"
sendTimeout="00:30:00">
<security mode="None">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxDepth="100"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
我正在发送 25Mb 的文件并且可以正常工作,但是当我尝试上传 30Mb 或更大的文件时,我的项目无法访问该服务,并抛出此错误消息:
"There was no listening endpoint at http://localhost:55010/FileService.svc able to accept the message." 这通常是由不正确的 SOAP 地址或操作引起的。获取更多详细信息。 “
谢谢!
如果您在 IIS Express 或 IIS 中托管您的服务,请求过滤模块的 maxAllowedContentLength
的默认值可能会妨碍(默认情况下为 30000000)。
尝试通过在 web.config 文件中添加如下内容来增加它:
<system.webServer>
<security>
<requestFiltering >
<requestLimits maxAllowedContentLength="52428800" />
<requestFiltering>
</security>
</system.webServer>
我使用以下行解决了服务器 web.config 上的问题:
<httpRuntime targetFramework="4.5" enableVersionHeader="false" maxRequestLength="2147483647" executionTimeout="1600" requestLengthDiskThreshold="2147483647" />
现在我的问题是 System.OutOfMemoryException 当我试图将我的流复制到内存流时,但它不在 post 范围内。
谢谢大家!