簡體   English   中英

root(/)目錄中沒有web.config文件

[英]web.config file not there in the root(/) directory

我試圖運行.cshtml文件,但出現錯誤:

Server Error in '/' Application.
--------------------------------------------------------------------------------


This type of page is not served. 
  Description: The type of page you have requested is not served because it has been explicitly forbidden.  The extension '.cshtml' may be incorrect.   Please review the URL below and make sure that it is spelled correctly. 

 Requested URL: /index.cshtml

因此,我搜索了解決方案,發現我必須編輯根目錄(這里是“我的網站”)中的web.config文件,但是沒有像這樣的文件存在,只有一個index.cshtml創建。

我甚至在Programs Files\\搜索了IISIIS Express文件夾,但是沒有這樣的文件?

如果您使用的是WebMatrix,則可能您的錯誤是起點選擇。

如果要創建一個新的Web站點,則必須從WebMatrix模板庫中的模板開始。 請注意,“空站點”模板與“模板庫”外部的“空站點”選項有所不同,因為第一個模板包含所需的文件(二進制文件,程序包和web.config)。

正如服務器錯誤提示的那樣,不提供.cshtml文件,其原因是因為它們是組成應用程序的服務器端文件,它們只是更大的一部分。

如果您以調試模式啟動Web應用程序,並且瀏覽器中的URL類似於http://localhost:2932/Views/Home/Index.cshtml ,則只需刪除URL的/Views/Home/Index.cshtml部分。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM