Does fastcgi-mono-serverX work with mono 3.0 & ngi

2019-05-04 09:49发布

I have been trying for some days to get mono 3.0 & nginx 1.2.4 and fastcgi-mono-serverX in the XSP 2.10 package going on Centos 6.3 ...the XSP4 server works but I can't get the fastcgi method working.

I built and tested mono 3.0 from source, it works fine.

I followed the config at http://www.mono-project.com/FastCGI_Nginx to no avail and many other settings from the nginx site.

...does the current XSP 2.10 module work with mono 3.0?
...should I downgrade mono to 2.11.4 to work with XSP 2.10? ...ultimately I would like to run ASP.Net 4.0 Web Forms

Update: Here's some output from the mono-server.log:

    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 
[2012-11-05 12:35:14Z] Error   Failed to process connection. Reason: The object was used after being disposed.

标签: mono
2条回答
该账号已被封号
2楼-- · 2019-05-04 10:31

If you use Mono 3.0, use a tag from xsp that is 3.x too. End of story.

Also, to avoid bugs like 3582, use Mono 3.0.3 or higher.

查看更多
你好瞎i
3楼-- · 2019-05-04 10:40

I was about to file a bug report with Xamarin... then I came across this submitted bug report from a year ago.

https://bugzilla.xamarin.com/show_bug.cgi?id=2876

tl;dr

You need to update the shell script (found with which mono-fastcgi-server4), and move mono-fastcgi-server4.exe from /usr/lib/mono/4.0 to /usr/lib/mono/4.5.

Longer Explanation

As mentioned, I'm using the mono-fastcgi-server4 package directly from the main canonical Ubuntu source which lists these file contents

/usr/bin/fastcgi-mono-server4
/usr/lib/mono/4.0/fastcgi-mono-server4.exe
/usr/lib/mono/gac/fastcgi-mono-server4/2.10.0.0__0738eb9f132ed756/fastcgi-mono-server4.exe
/usr/share/doc/mono-fastcgi-server4/AUTHORS
/usr/share/doc/mono-fastcgi-server4/NEWS.gz
/usr/share/doc/mono-fastcgi-server4/README
/usr/share/doc/mono-fastcgi-server4/README.Debian
/usr/share/doc/mono-fastcgi-server4/changelog.Debian.gz
/usr/share/doc/mono-fastcgi-server4/copyright
/usr/share/man/man1/fastcgi-mono-server4.1.gz

Based on the bug report solution, I was able to get this working. Essentially you edit the shell script used to launch fastcgi-mono-server4.exe by hand (which should be in /usr/bin), and move the .exe file by hand... or... you can use this little snippet of script that I incorporated into the deploy:setup of a Capistrano script. It uses sed to update the script.

fastcgi=$(which fastcgi-mono-server4) &&
sudo sed -i.bak -e 's/4\\.0/4.5/' $fastcgi &&
fastcgi_src='/usr/lib/mono/4.0/fastcgi-mono-server4.exe' &&
fastcgi_dest='/usr/lib/mono/4.5/fastcgi-mono-server4.exe' &&
if [ -f "$fastcgi_src" ]; then sudo mv $fastcgi_src $fastcgi_dest; fi;

This report also seems related https://bugzilla.xamarin.com/show_bug.cgi?id=3582

查看更多
登录 后发表回答