Asp.net 带有mono fastcgi的nginx坏网关502

Asp.net 带有mono fastcgi的nginx坏网关502,asp.net,razor,mono,nginx,fastcgi,Asp.net,Razor,Mono,Nginx,Fastcgi,您好,我一直在尝试让我的网站在mono(ubuntu服务器)上运行,我几乎不折不扣地遵循: 但是,当我的目录不为空时,fastcgi日志会显示: Notice Beginning to receive records on connection. Error Failed to process connection. Reason: Exception has been thrown by the target of an invocation. 我不确定这意味着什么,根

您好,我一直在尝试让我的网站在mono(ubuntu服务器)上运行,我几乎不折不扣地遵循:

但是,当我的目录不为空时,fastcgi日志会显示:

    Notice  Beginning to receive records on connection.
    Error   Failed to process connection. Reason: Exception has been thrown by the target of an invocation.
我不确定这意味着什么,根据我所做的,我可能会得到另一个错误,告诉我找不到资源:

找不到资源

    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.   Please review the following URL and make sure that it is spelled correctly.
请求的URL:/Default.aspx/ 版本信息:Mono运行时版本:2.10.8(tarball Thu Aug 16 23:46:03 UTC 2012)ASP.NET版本:4.0.30319.1

如果我需要提供更多的信息,请让我知道

编辑:

我现在收到一个nginx网关错误

我的nginx配置文件如下所示:

server {
    listen   2194;
    server_name localhost;
    access_log $HOME/WWW/nginx.log;

    location / {
      root $HOME/WWW/dev/;
      index index.html index.html default.aspx Default.aspx Index.cshtml;
      fastcgi_index Views/Home/; 
      fastcgi_pass 127.0.0.1:8000;
      include /etc/nginx/fastcgi_params;
    }
}
通过使用xsp4运行整个过程,我发现了“调用目标引发的异常”

处理异常类型TargetInvocationException消息为exception 已由调用的目标抛出。设置了一个新的设置 到True System.Reflection.TargetInvocationException:异常已发生 被调用的目标抛出

服务器堆栈跟踪:位于System.Reflection.Method.Invoke (System.Object obj,BindingFlags invokeAttr,
System.Reflection.Binder,System.Object[]参数,
System.Globalization.CultureInfo区域性)[0x00000]位于:0中的System.Reflection.MethodBase.Invoke(System.Object obj,System.Object[]参数)[0x00000]位于:0
在System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager, iUrrogateSelector选择器,StreamingContext上下文)[0x00000]位于 :0 at 中的System.Runtime.Serialization.ObjectManager.DoFixups()[0x00000] :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader)[0x00000]输入:0
在 System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement元素,System.IO.BinaryReader读取器,布尔值 ReadHeader、System.Object和result、, 中的System.Runtime.Remoting.Messaging.Header[]和headers)[0x00000] :0 at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream序列化流, 中的System.Runtime.Remoting.Messaging.HeaderHandler处理程序)[0x00000] :0 at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream)[0x00000]位于:0处 System.Runtime.Remoting.RemotingServices.DeserializeCallData (System.Byte[]数组)[0x00000]in:0 at(包装器) xdomain dispatch)System.AppDomain:DoCallBack(对象,字节[]&,字节[]&)

[0]处的异常重试:-->System.ArgumentException:无法 绑定到方法“SetHostingEnvironment”。在 System.Delegate.GetCandidateMethod(System.Type类型,System.Type类型 target、System.String方法、BindingFlags、bflags、Boolean ignoreCase、, 位于以下位置的0中的布尔throwOnBindFailure)[0x00000] System.Delegate.CreateDelegate(System.Type类型、System.Type目标、, System.String方法,布尔ignoreCase,布尔throwOnBindFailure) [0x00000]in:0位于System.Delegate.CreateDelegate (System.Type类型,System.Type目标,System.String方法)[0x00000] in:0 at System.DelegateSerializationHolder+DelegateEntry.DeserializeDelegate (System.Runtime.Serialization.SerializationInfo信息)[0x00000]位于 :0位于System.DelegateSerializationHolder..ctor处 (System.Runtime.Serialization.SerializationInfo信息,StreamingContext ctx)[0x00000]英寸:0英寸(包装器 管理到本机)System.Reflection.Method:InternalInvoke (System.Reflection.method,object,object[],System.Exception&)位于 System.Reflection.Method.Invoke(System.Object对象,BindingFlags invokeAttr,System.Reflection.Binder活页夹,System.Object[] 参数,System.Globalization.CultureInfo区域性)[0x00000]位于 :0---内部异常堆栈跟踪的结束---
at(包装器xdomain invoke)System.AppDomain:DoCallBack (System.CrossAppDomainDelegate)位于(包装器) 远程处理(通过检查调用)系统。AppDomain:DoCallBack (System.CrossAppDomainDelegate)位于 System.Web.Hosting.ApplicationHost.CreateApplicationHost(System.Type 主机类型,System.String virtualDir,System.String physicalDir) [0x00000]英寸:0英寸 Mono.WebServer.vpathtoost.CreateHost (Mono.WebServer.ApplicationServer服务器,Mono.WebServer.WebSource 位于的0中的webSource)[0x00000] Mono.WebServer.XSP.Server.RealMain(System.String[]args,布尔值 根目录,IApplicationHost ext\u apphost,布尔安静)[0x00000]输入 :0位于Mono.WebServer.XSP.Server.Main (System.String[]args)[0x00000]位于:0中

404URL为“/Default.aspx/”

因为它的末尾有一个目录,我猜您希望它查找一个文件Default.aspx

fastcgi连接的nginx配置块是什么样子的

更新(添加请求的信息后):

解释fastcgi_index指令。你的设置方式有点奇怪你在添加视图/主页/ 到任何目录的$fastcgi\u script\u名称

您可能希望将fastcgi_索引设置为Default.aspx(然后它将以directory/Default.aspx的形式传递任何目录请求,我认为这就是您想要的)

您也没有设置脚本文件名,mono可能会使用它来知道要运行哪个文件(在任何情况下,这就是它与php/ruby fastcgi一起工作的方式)

对于位置块中的nginx参数,您可能需要以下内容:

fastcgi_index Default.aspx;
fastcgi_param SCRIPT_FILENAME $HOME/WWW/dev/home/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:8000;
include /etc/nginx/fastcgi_params;
(如果我正确阅读了您的教程,脚本文件名可能只是$fastcgi\u SCRIPT\u name)

顺便说一句,通常在serverblock级别设置一次索引和根指令,这样就不必为每个位置块重复它,尽管由于您只有一个位置块,这并不重要<
fastcgi_index   /;
fastcgi_index Default.aspx;
fastcgi_index Views/Home/;
index index.html index.html default.aspx Default.aspx Index.cshtml;
System.TypeLoadException: Could not load type
    at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type)