如何将 VS2010 网站 (Razor) 部署到 Windows Server 2008 上的 IIS7?
我创建了一个指向这些文件的新应用程序。它在 ASP.NET 4.0 集成应用程序池中运行。
这些文件只是几个 CSHTML 文件和一些 CSS/Javascript。
当文件是 HTML 时,我能够很好地点击它们。现在它们是 cshtml,
This type of page is not served
当我尝试在浏览器中点击 Directory/File.cshtml 时,我得到了。
我通常编写 MVC3 应用程序,但这只是一个需要启动的简单的 2 页网站。我不熟悉此类项目的部署。任何建议都会有帮助。
我的 web.config 很简单,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="MyFile.cshtml"/>
</files>
</defaultDocument>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
预先感谢您的帮助!
I've created a new Application that points to the files. It is running in ASP.NET 4.0 Integrated App Pool.
The files are just a couple of CSHTML files and some CSS/Javascript.
When the files were HTML I was able to hit them just fine. Now that they are cshtml, I get
This type of page is not served
when I try to hit the Directory/File.cshtml in a browser.
I usually write MVC3 apps, but this is just a simple 2 page site that needs to be up. I'm not familiar with deployment of these types of projects. Any advice would be helpful.
My web.config is simple and looks as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="MyFile.cshtml"/>
</files>
</defaultDocument>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Thanks in advance for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解决此问题,请使用“Web 平台安装程序”(http://www.microsoft.com/web/downloads/platform.aspx) 安装“ASP.NET MVC 3 (Visual Studio 2010)”包。
To fix this, install the "ASP.NET MVC 3 (Visual Studio 2010)" package using the "Web Platform Installer" (http://www.microsoft.com/web/downloads/platform.aspx).