zoukankan      html  css  js  c++  java
  • runAllManagedModulesForAllRequests 和 invalid url

    有这样的经验, 在本地的 IIS 上网站运行正常,但是发布到服务器上就一堆怪怪的问题 : 

    MVC routing not work
    http://stackoverflow.com/questions/12495346/asp-net-4-5-mvc-4-not-working-on-windows-server-2008-iis-7
    http://www.britishdeveloper.co.uk/2010/06/dont-use-modules-runallmanagedmodulesfo.html
    Owin not work
    http://stackoverflow.com/questions/23276144/microsoft-owin-host-systemweb-and-still-getting-no-owin-environment-item-was-fou
    AuthorizeAttribute not work
    http://stackoverflow.com/questions/21170269/asp-net-mvc5-application-throwing-nullreferenceexception-when-authorizing
    http://stackoverflow.com/questions/11048863/modules-runallmanagedmodulesforallrequests-true-meaning

    Odata action 404

    等等, 这么多怪怪的问题,都可以用 runAllManagedModulesForAllRequests=”true“ 来解决. 

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" >
        </modules>  
    </system.webServer>

    但这不是个好方法. 因为性能会浪费, 还有一些静态文件的请求可能会被要求验证 (比如图片是可以含有 & 符号的, 但是你设置了这个, 就会被验证成 invalid 了).

    网上有很多替代的方案. 但是我发现在 IIS 8.5 的情况下, 基本上你只要用 vs2015 MVC template 的 webconfig 就不会遇到怪怪的问题了。 

    odata action 404 则需要加一行代码在 webserver handler 里面

          <add name="ExtensionlessUrlHandler-Integrated-4.0Custom" path="/api*" verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />

    另外提一下, IIS 使用的是 RFC 2396 对 url 进行检查 

    http://www.cnblogs.com/shaomeng/p/5171178.html

    要注意图片的路径哦. 

  • 相关阅读:
    ffmpeg rtmp推流 视频转码
    java日志发展史 log4j slf4j log4j2 jul jcl 日志和各种桥接包的关系
    nginx stream 流转发,可以转发rtmp、mysql访问流,转发rtmp、jdbc请求
    java web http 转https 通过nginx代理访问
    linux 服务器磁盘挂载
    novnc 通过websockify代理 配置多点访问
    linux 文件服务 minio 安装部署配置
    AOP实现原理,手写aop
    java 泛型
    JAVA反射getGenericSuperclass()用法
  • 原文地址:https://www.cnblogs.com/keatkeat/p/6154901.html
Copyright © 2011-2022 走看看