有这样的经验, 在本地的 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

要注意图片的路径哦.

runAllManagedModulesForAllRequests 和 invalid url的更多相关文章

  1. IIS问题解决:URL中制表符引起的Bad Request - Invalid URL

    昨天处理好了Google网站管理员中的500错误,今天处理了一些400处理,比如下面的以制表符(tab)结尾的URL: http://www.cnblogs.com/me-sa/archive/200 ...

  2. 微信开发-微信JSSDK错误:invalid url domain

    错误类型:invalid url domain 调试返回参数: { "errMsg": "config:invalid url domain" } 截图: 环境 ...

  3. 微信SDK 报错 invalid url domanin

    刚开始我在安全JS域名下填写: Http://hgj123.8.yydns.pw   带了Http 在微信中开打自己写好demo.报invalid url domanin 说我的无效URL. 然后我在 ...

  4. requests.exceptions.MissingSchema: Invalid URL 'xxxxxxxxxxxxx': No schema supplied. Perhaps you meant xxxxxxxxxxxxx

    import requests session = requests.session() carProposalUrl = "www.caaaa.com.cn/aaaa/aaaaa/carP ...

  5. 微信开发 config:invalid url domain

    当遇到config:invalid url domain 有2种可能 1.没有配置url. 2.url配置错误.配置url如http://write.blog.csdn.NET/,就要这样配置writ ...

  6. 微信测试号:config:invalid url domain

    今天调试微信分享的时候,配置参数时一直提示config:invalid url domain,网上找了一下,都说是appId和域名没有绑定.仔细看了下,有绑定没错.又猜测是不是二级域名的问题,因为是测 ...

  7. vue 运行项目时,Uncaught (in promise) DOMException: Failed to execute 'open' on 'XMLHttpRequest': Invalid URL

    npm  run dev 运行项目后 验证码显示不出来 并报错 Uncaught (in promise) DOMException: Failed to execute 'open' on 'XML ...

  8. 微信分享报错config:invalid url domain

    错误类型:invalid url domain 调试返回参数: { "errMsg": "config:invalid url domain" } 截图: 环境 ...

  9. 微信小游戏 three.js jsonloader request:fail invalid url

    微信小游戏中,用 THREE.JSONLoader 直接加载本地的 json 文件,报错.估计是跨域访问的问题 解决:把 json 文件放到服务器上,通过 url 来访问. 临时测试的话,在本地起一个 ...

随机推荐

  1. 怎样给filter加入自己定义接口及调用

    本样例是在VirtualCamera的基础上加入的自己定义接口用来实现exe控制osd的显示. 1. 接口部分 #ifndef __H_MyFilter__#define __H_MyFilter__ ...

  2. 安全通信 QSslSocket

    The QSslSocket class provides an SSL encrypted socket for both clients and servers. More... Header: ...

  3. SpringMVC + Spring 3.2.14 + Hibernate 3.6.10 集成详解

    注:此文档只说明简单的框架集成,各个框架的高级特性未涉及,刚刚接触框架的新人可能需要参考其他资料. PS:本次练习所用jar包都能在此下载到:http://pan.baidu.com/s/1sjmgd ...

  4. Optimized Pagination using MySQL---reference

    Dealing with large data sets makes it necessary to pick out only the newest or the hottest elements ...

  5. [转] 整理了一份React-Native学习指南

    自己在学习React-Native过程中整理的一份学习指南,包含 教程.开源app和资源网站等,还在不断更新中.欢迎pull requests! React-Native学习指南 本指南汇集React ...

  6. Windows开启Telnet

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/SJQ. http://www.cnblogs.com/shijiaqi1066/p/4301513.html ...

  7. SQL常用的语句和函数

    order by 的数值型灵活使用 select * from table_a where order by decode(函数,'asc',1,'desc',-1)*jsny; 控制试图的访问时间: ...

  8. 表达式:使用API创建表达式树(6)

    一.ConstantExpression:表示具有常量值的表达式.因为表达式应用过程中,参数据多是 Expressions 类型,算是对常量值的一种包装吧. ConstantExpression使用比 ...

  9. (转)修改ECSHOP前后台的title中的ecshop

    前台部分: 1:去掉头部TITLE部分的ECSHOP演示站 Powered by ecshop 前者在后台商店设置 - 商店标题修改 后者打开includes/lib_main.php $page_t ...

  10. Asp.net Mvc4 基于Authorize实现的模块访问权限

    在MVC中,我们可以通过在action或者controller上设置Authorize[Role="xxx"] 的方式来设置用户对action的访问权限.显然,这样并不能满足我们的 ...