zoukankan      html  css  js  c++  java
  • Request Entity Too Large for Self Hosted ASP.Net Web API在Selfhost的api后台怎么解决Request Entity Too Large问题

    Request Entity Too Large for Self Hosted ASP.Net Web API在Selfhost的api后台怎么解决Request Entity Too Large问题

    如果用的IIS承载api,可以在web.config中添加配置来解决

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <customErrors mode="Off"/>
        <httpRuntime
            maxRequestLength="2147483647"
            executionTimeout="300" />
    </system.web>

    但在Selfhost中App.config没办法添加此配置

    正常的添加方法应该在添加selfhost绑定配置项时添加

    var config = new HttpSelfHostConfiguration(host);
    config.MaxReceivedMessageSize = 2147483647; // use config for this value
    /*
    other setup for the config
    */
    using (var server = new HttpSelfHostServer(config))
    {
        server.OpenAsync().Wait();
        Console.WriteLine("Insight.Web");
        Console.ReadLine();
    }
  • 相关阅读:
    servicestack and redis
    图片服务器
    CRQS介绍
    javascript闭包之购物车加减及提示
    javascript best practices
    EOF
    2012年回顾
    volatile
    通过inode来操作文件
    采样问题
  • 原文地址:https://www.cnblogs.com/mxm2005/p/5386241.html
Copyright © 2011-2022 走看看