对于是否在单剃刀视图引擎的工作? [英] Does the Razor View Engine work for Mono?

查看:203
本文介绍了对于是否在单剃刀视图引擎的工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着搜索了一下,并没有找到答案。在是否单剃刀视图引擎的工作?

I tried searching a bit and didn't find an answer. Does the Razor View Engine work in Mono?

推荐答案

是的,它的作用。我把它用在Linux上单的工作。

Yes, it does. I have it working with mono on Linux.

您需要从
从稳定来源单声道2.10.2+
http://ftp.novell.com/pub/mono/sources-stable /

http://download.mono-project.com/sources/mono/

然后,您需要将这些组件localcopy到你的应用程序的bin目录(你把他们从Visual Studio在Windows上):

Then, you need to localcopy these assemblies into your app's bin directory (you take them from Visual Studio on Windows):



System.Web.Razor.dll

System.Web.WebPages.dll

System.Web.WebPages.Deployment.dll

System.Web.WebPages.Razor.dll

System.Web.Mvc.dll
System.Web.Razor.dll
System.Web.WebPages.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll

然后,您可能必须摆脱你可能犯了这样的下列错误:


Then, you might have to get rid of the following errors you might have made like this:

错误:当_AppStart正在执行不能创建存储范围。

原因:Microsoft.Web.Infrastructure.dll被localcopied到bin
目录。

分辨率:删除Microsoft.Web.Infrastructure.dll ,并使用单
版本





错误:无效IL code在System.Web.Handlers.ScriptModule:.ctor():
方法体是空的。

原因:System.Web.Extensions.dll不知何故被localcopied到bin
目录。

分辨率:删除System.Web.Extensions.dll ,并使用单声道版本






错误:模块中的类不能被加载。说明:HTTP
500.错误处理请求。

原因:System.Web.WebPages.Administration.dll被localcopied到bin
目录。

分辨率:删除System.Web.WebPages.Administration.dll 并unreference它





错误:无法加载类型

从程序集System.Web.WebPages.Razor.RazorBuildProvider
System.Web.WebPages.Razor,版本= 1.0.0.0,文化=中立,
公钥= 31bf3856ad364e35'。说明:HTTP 500错误
加工的要求。

原因:System.Web.Razor.dll已损坏或丢失(或x64,而不是X32或反之亦然)

分辨率:获得两袖清风 System.Web.Razor.dll的版本,
localcopy到bin目录

Error: Storage scopes cannot be created when _AppStart is executing.
Cause: Microsoft.Web.Infrastructure.dll was localcopied to the bin directory.
Resolution: Delete Microsoft.Web.Infrastructure.dll and use the mono version.

Error: Invalid IL code in System.Web.Handlers.ScriptModule:.ctor (): method body is empty.
Cause: System.Web.Extensions.dll somehow gets localcopied to the bin directory.
Resolution: Delete System.Web.Extensions.dll and use the mono version.


Error: The classes in the module cannot be loaded. Description: HTTP 500. Error processing request.
Cause: System.Web.WebPages.Administration.dll was localcopied to the bin directory.
Resolution: Delete System.Web.WebPages.Administration.dll and unreference it


Error: Could not load type
'System.Web.WebPages.Razor.RazorBuildProvider' from assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Description: HTTP 500. Error processing request.
Cause: System.Web.Razor.dll is corrupt or missing (or x64 instead of x32 or vice-versa) ...
Resolution: Get an uncorrupted version of System.Web.Razor.dll and localcopy to the bin directory

修改

为单声道2.12 / MonoDevelop的2.8,这一切是没有必要了。

Edit
As of mono 2.12 / MonoDevelop 2.8, all of this is not necessary anymore.

注意在2.10(Ubuntu的11.10),需要localcopy System.Web.DynamicData.dll 为好,否则你才会有的App_Start错误(如果你不这样做,你会得到一个YSOD你第一次调用一个页面,但只有第一次,因为只有这样App_Start叫)。

Note that on 2.10 (Ubuntu 11.10), one needs to localcopy System.Web.DynamicData.dll as well, or else you get an error that only occurs on App_Start (if you don't do that, you get a YSOD the first time you call a page, but ONLY the first time, because only then App_Start is called.).

注意

对于单3.0+与ASP.NET MVC4:
有一个错误的安装脚本。
或者说一个不完整。

Note
for mono 3.0+ with ASP.NET MVC4: There is a "bug" in the install script. Or rather an incompleteness.

MOD-单,FastCGI的,单服务器4和xsp4将无法正常工作。

例如:FastCGI的-单服务器4给你这调试输出:

mod-mono, fastcgi-mono-server4 and xsp4 won't work correctly.
For example: fastcgi-mono-server4 gives you this debug output:

[error] 3384#0: *101 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:8000"

这是,因为安装mono3后,它使用框架4.5,但XSP,fastcgi的单 - 服务器4和模 - 单不在4.5 GAC中,只有4.0 GAC。

为了解决这个问题,使用bash脚本:

This is, because after the installation of mono3, it uses framework 4.5, but xsp, fastcgi-mono-server4 and mod-mono are not in the 4.5 GAC, only the 4.0 gac.
To fix this, use this bash script:

#!/bin/bash

# Your mono directory
#PREFIX=/usr
PREFIX=/opt/mono/3.0.3


FILES=('mod-mono-server4'
       'fastcgi-mono-server4'
       'xsp4')

cd $PREFIX/lib/mono/4.0

for file in "${FILES[@]}"
do
   cp "$file.exe" ../4.5
done


cd $PREFIX/bin

for file in "${FILES[@]}"
do
  sed -ie 's|mono/4.0|mono/4.5|g' $file
done

如果您通过FastCGI的使用(如nginx的),你还需要此修复程序的TransmitFile的chuncked_encoding错误

<一href=\"http://stackoverflow.com/questions/14662795/why-do-i-have-unwanted-extra-bytes-at-the-beginning-of-image/14671753#14671753\">Why我必须在图像的开头不需要额外的字节?(固定单3.2.3)

PS:

你可以从这里3.x中.deb文件:

https://www.meebey.net/posts/mono_3.0_$p$ pview_debian_ubuntu_packages /
或者从GitHub编译它们yourselfs
安装Mono 3.X
或者像这样从稳定的来源
http://ubuntuforums.org/showthread.php?t=1591370

2015年

您现在可以使用 Xamarin提供的软件包

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update

如果您需要的变化最新功能,还可以抓取的 CI包(每晚构建,可以这么说),如果​​你需要最新的(或几乎最新)版本

If you need the vary latest features, you can also fetch the CI packages (nightly builds, so to say), if you need the latest (or almost latest) version

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://jenkins.mono-project.com/repo/debian sid main" | sudo tee /etc/apt/sources.list.d/mono-jenkins.list
sudo apt-get update

这篇关于对于是否在单剃刀视图引擎的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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