不工作IIS .cshtml文件 [英] .cshtml files not working IIS
问题描述
我在Windows Server 2012中,我配置IIS 8 .cshtml文件的工作。
I have Windows Server 2012, I configure IIS 8 to work with .cshtml files.
- 我已经安装ASP.NET
- 我已经添加到.cshtml MIME类型
- 我在bin文件夹中的DLL。
但是当我打开一个页面code只是看起来像简单的文本。
but when I open a page the code just appears like simple text.
我做了什么错?我怎样才能解决这个问题,这样的.cshtml呈现为网页?
What have I done wrong? How can I fix this so that the .cshtml is rendered as a web page?
推荐答案
您可能需要安装ASP.Net网页。你可以在这里使用独立的安装与MVC4得到它一起: http://www.asp.net/mvc/mvc4
You probably need to install ASP.Net Webpages. You can get it along with MVC4 using the standalone installer here: http://www.asp.net/mvc/mvc4
另外,你能ASP.Net网页在web.config中?
Also, did you enable ASP.Net webpages in web.config?
<add key="webpages:Enabled" value="true" />
网页:启用
值为假
prevents .cshtml
在 .vbhtml
文件>查看文件夹中。
webPages:enabled
with value false
prevents .cshtml
or .vbhtml
files in the Views
folder from being directly accessible from a web browser.
这篇关于不工作IIS .cshtml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!