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”。並把復制到本地改為“True”

 

大功告成

 

 

后記:找了原因所在,自己也在想是什么原因:之前一直MVC+EF來開發,后來發現要吐槽一點點EF就換到了ADO。改成了MVC4+ADO.NET 沒有安裝基礎包。。。。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM