【问题标题】:MTOM enabled, getting "Maximum request length exceeded." still启用 MTOM,收到“超出最大请求长度”。仍然
【发布时间】:2012-01-25 01:51:01
【问题描述】:

这越来越令人沮丧...我对 Web 服务是半新的,我真的不明白为什么我无法弄清楚如何使用 Microsoft WSE 3.0 在我的 Web 服务上为 SOAP 启用 MTOM 编码。我已将以下内容添加到我的网络服务中:

服务器上我的库中的 Web.config 和 app.config:

<configuration>
    <configSections>
        <section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </configSections>
    <system.web>
        <httpRuntime maxRequestLength="134217728" executionTimeout="300"/>
        <webServices>
            <soapExtensionImporterTypes>
                <add type="Microsoft.Web.Services3.Description.WseExtensionImporter, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
            </soapExtensionImporterTypes>
            <soapServerProtocolFactory type="Microsoft.Web.Services3.WseProtocolFactory, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        </webServices>
        <compilation>
            <assemblies>
                <add assembly="Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>
    </system.web>
    <microsoft.web.services3>
        <messaging>
            <mtom serverMode="always" />
            <maxMessageLength value="134217728" />
        </messaging>
    </microsoft.web.services3>
</configuration>

在客户端,我在 app.config 中添加了相同的内容,添加了 did clientMode="On"。

当我尝试上传 40MB 文件时,我收到常见错误“超出最大请求长度”。

有什么解释吗?我是否必须告诉传输使用该配置?我怎么做?谢谢!

【问题讨论】:

    标签: c# asp.net web-services soap mtom


    【解决方案1】:

    您可能遇到了 Web 服务器的 maxAllowedContentLength。如果您正在运行 IIS7,请尝试将此代码块添加到您的 web.config。 IIS7 在 http 运行时获取请求之前过滤请求。

    http://msdn.microsoft.com/en-us/library/ie/ms689462(v=vs.90).aspx

    <system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="134217728" />
            </requestFiltering>
        </security>
    </system.webServer>
    

    【讨论】:

    • 你是我的英雄!!!连续坚持了3天!我爱你!非常感谢!
    • 确保将其添加到主 Web.config 而不是 Views 文件夹中的那个...
    猜你喜欢
    • 1970-01-01
    • 2011-04-20
    • 2015-11-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多