IIS 6 究竟需要做什么才能为 cshtml 页面提供服务? [英] What exactly needs done to IIS 6 to serve cshtml pages?

查看:23
本文介绍了IIS 6 究竟需要做什么才能为 cshtml 页面提供服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的网站升级到 .Net4,但在请求 .cshtml 文件时(即使它是没有剃刀的纯 html),我收到连接被拒绝的错误.缺少什么?

I have upgraded my site to .Net4 but when requesting a .cshtml file (even if it is pure html without razor) I get a Connection refused error. What's missing?

更新:发生了一些变化,现在我收到未提供此类页面"错误.我认为 .Net4 就是所需要的.

Update: something changed and now I get a "This type of page is not served" error. I thought .Net4 was all that was required.

推荐答案

事实证明,这只是在 bin 目录中有正确的文件并在 web 配置中有一个条目的问题.这是文件列表:

Turns out it was simply a matter of having the correct files in the bin dir and an entry in web config. Here's the list of files:

  • Microsoft.Web.Infrastructure.dll
  • NuGet.Core.dll
  • System.Web.Helpers.dll
  • System.Web.Razor.dll
  • System.Web.WebPages.Administration.dll
  • System.Web.WebPages.Deployment.dll
  • System.Web.WebPages.dll
  • System.Web.WebPages.Razor.dll

这是我在 web.config 中需要的:

and here's what I needed in web.config:

<compilation>
  <assemblies>
    <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  </assemblies>
  <buildProviders>
    <add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
  </buildProviders>
</compilation>

这篇关于IIS 6 究竟需要做什么才能为 cshtml 页面提供服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆