IIS 6为服务cshtml页面需要做些什么? [英] What exactly needs done to IIS 6 to serve cshtml pages?

查看:205
本文介绍了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天全站免登陆