MVC4 本地正常运行,发布到IIS7->403 - 禁止访问: 访问被拒绝。

原文: MVC4 本地正常运行,发布到IIS7->403 - 禁止访问: 访问被拒绝。

  上周五代码编写完成,计划发布一个版本测试,没想到发布到IIS7 竟然报错“403-禁止访问”。还真第一次遇到这种问题。。。。。

折腾了半天,终于解决。

1、提示报错403:

禁止访问: 访问被拒绝。您无权使用所提供的凭据查看此目录或页面。”

解决方案-在<system.webServer>后加上:<modules runAllManagedModulesForAllRequests="true"/> 

 

2、有了第一步,出现的问题也不一样,很开心,至少有进展

“Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

如图:

 

3、按错误提示webconfig 加上:<customErrors mode="Off"/>

 

4、好像越来越明朗了

 下载“Microsoft.Web.Infrastructure.dll”。DLL放入到Bin文件夹下。

大功告成

 

 

后记:找了原因所在,自己也在想是什么原因:之前一直MVC+EF来开发,后来发现要吐槽一点点EF就换到了ADO。改成了MVC4+ADO.NET 没有安装基础包。。。。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值