C# debian上的nginx、mono和fastcgi网关不好

C# debian上的nginx、mono和fastcgi网关不好,c#,nginx,mono,debian,fastcgi,C#,Nginx,Mono,Debian,Fastcgi,我正在为Linux的.NET替代mono而挣扎。这是我的元数据: OS: Debian 7.6 alias Wheezy (as virtual machine; host: Windows 7 Pro SP1) nginx v1.6.1 (installed from nginx repository) mono v3.6.0 (compiled from source) mono-fastcgi-server4

我正在为Linux的.NET替代mono而挣扎。这是我的元数据:

OS: Debian 7.6 alias Wheezy   (as virtual machine; host: Windows 7 Pro SP1)
nginx v1.6.1                  (installed from nginx repository)
mono v3.6.0                   (compiled from source)
mono-fastcgi-server4          (installed from Debian repositories)
nginx工作正常;我在没有单声道的情况下测试了它,所以这应该不是问题

当我在nginxserver配置中启用fastcgi部分时,问题就出现了:我得到了一个502坏网关

供您参考,这些都是我到目前为止编辑的配置文件。我认为这些是重要的:

/etc/nginx/conf.d/default.conf

server {
   listen        80;
   server_name   myserver.net;
   root          /var/www/myserver.net;
   index         index.html;

      location / {
         fastcgi_index   index.html;
         fastcgi_pass    127.0.0.1:9000;
         include         /etc/nginx/fastcgi_params;
      }
}
/etc/nginx/fastcgi_参数(除这两行外的原始参数)

fastcgi_param PATH_INFO          "";
fastcgi_param SCRIPT_FILENAME    $document_root$fastcgi_script_name;
/etc/init.d/mono-fastcgi/myserver.net.webapp

实际上我不知道,为什么
&
必须在最后出现,但是如果没有它,命令将无法工作。有什么建议吗

我想这就是我能与你分享的所有信息。如果缺少什么,请指出,我会尽快添加信息

编辑:我忘记添加fastcgi.log和nginx日志了/var/log/mono/fastcgi.log

[2014-09-04 10:39:20Z] Error   ERROR PROCESSING REQUEST: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.WebServer.FastCgi.WorkerRequest

Server stack trace: 
  at Mono.WebServer.FastCgi.ApplicationHost.ProcessRequest (Mono.WebServer.FastCgi.Responder responder) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper xdomain-dispatch) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (object,byte[]&,byte[]&)

Exception rethrown at [0]: 
 ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0 
  at Mono.WebServer.FastCgi.WorkerRequest..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at (wrapper xdomain-invoke) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at Mono.WebServer.FastCgi.Responder.Process () [0x00000] in <filename unknown>:0 
[2014-09-04 10:39:20Z] Error   Failed to process connection. Reason: The object was used after being disposed.
[2014-09-04 10:39:20Z] Notice  Beginning to receive records on connection.
[2014-09-04 10:39:20Z] Error   ERROR PROCESSING REQUEST: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.WebServer.FastCgi.WorkerRequest

Server stack trace: 
  at Mono.WebServer.FastCgi.ApplicationHost.ProcessRequest (Mono.WebServer.FastCgi.Responder responder) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper xdomain-dispatch) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (object,byte[]&,byte[]&)

Exception rethrown at [0]: 
 ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0 
  at Mono.WebServer.FastCgi.WorkerRequest..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at (wrapper xdomain-invoke) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at Mono.WebServer.FastCgi.Responder.Process () [0x00000] in <filename unknown>:0 
[2014-09-04 10:39:20Z] Error   Failed to process connection. Reason: The object was used after being disposed.
10.0.2.147 - - [04/Sep/2014:10:39:20 +0200] "GET /default.aspx HTTP/1.1" 502 574 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" "-"
10.0.2.147 - - [04/Sep/2014:10:39:20 +0200] "GET /favicon.ico HTTP/1.1" 502 574 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" "-"
2014/09/04 10:39:20 [error] 2928#0: *11 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 10.0.2.147, server: lexekon.net, request: "GET /default.aspx HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "lexekon.net"
2014/09/04 10:39:20 [error] 2928#0: *11 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 10.0.2.147, server: lexekon.net, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "lexekon.net"
/var/www/nginx/error.log

[2014-09-04 10:39:20Z] Error   ERROR PROCESSING REQUEST: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.WebServer.FastCgi.WorkerRequest

Server stack trace: 
  at Mono.WebServer.FastCgi.ApplicationHost.ProcessRequest (Mono.WebServer.FastCgi.Responder responder) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper xdomain-dispatch) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (object,byte[]&,byte[]&)

Exception rethrown at [0]: 
 ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0 
  at Mono.WebServer.FastCgi.WorkerRequest..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at (wrapper xdomain-invoke) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at Mono.WebServer.FastCgi.Responder.Process () [0x00000] in <filename unknown>:0 
[2014-09-04 10:39:20Z] Error   Failed to process connection. Reason: The object was used after being disposed.
[2014-09-04 10:39:20Z] Notice  Beginning to receive records on connection.
[2014-09-04 10:39:20Z] Error   ERROR PROCESSING REQUEST: System.TypeInitializationException: An exception was thrown by the type initializer for Mono.WebServer.FastCgi.WorkerRequest

Server stack trace: 
  at Mono.WebServer.FastCgi.ApplicationHost.ProcessRequest (Mono.WebServer.FastCgi.Responder responder) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper xdomain-dispatch) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (object,byte[]&,byte[]&)

Exception rethrown at [0]: 
 ---> System.InvalidCastException: Cannot cast from source type to destination type.
  at System.Configuration.ConfigurationManager.get_AppSettings () [0x00000] in <filename unknown>:0 
  at Mono.WebServer.FastCgi.WorkerRequest..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at (wrapper xdomain-invoke) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at (wrapper remoting-invoke-with-check) Mono.WebServer.FastCgi.ApplicationHost:ProcessRequest (Mono.WebServer.FastCgi.Responder)
  at Mono.WebServer.FastCgi.Responder.Process () [0x00000] in <filename unknown>:0 
[2014-09-04 10:39:20Z] Error   Failed to process connection. Reason: The object was used after being disposed.
10.0.2.147 - - [04/Sep/2014:10:39:20 +0200] "GET /default.aspx HTTP/1.1" 502 574 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" "-"
10.0.2.147 - - [04/Sep/2014:10:39:20 +0200] "GET /favicon.ico HTTP/1.1" 502 574 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36" "-"
2014/09/04 10:39:20 [error] 2928#0: *11 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 10.0.2.147, server: lexekon.net, request: "GET /default.aspx HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "lexekon.net"
2014/09/04 10:39:20 [error] 2928#0: *11 upstream sent unexpected FastCGI record: 3 while reading response header from upstream, client: 10.0.2.147, server: lexekon.net, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "lexekon.net"

只是一个疑问:
fastcgi-mono-server4
是否支持mono3.6?Mono3.6似乎是.NET4.5。我不认为这是问题所在,因为我甚至无法访问html页面。我的意思是,fastsgi服务器应该忽略html页面,不是吗?在将mono从2.8.10升级到3.10之后,我现在也遇到了同样的问题,没有改变任何其他内容,因此fastcgi-mono-server4和mono 3.6之间的版本不匹配