Mvc3 running target environment
- Linux: centos6.2
- Nginx: 1.2
- Mono: 2.11.4
- Xsp: 2.10.2.0
Installation steps:
1. Download the program source code (you can download it from the official website)
- Nginx source package: http://nginx.org/download/nginx-1.2.4.tar.gz
- Mono source package: http://download.mono-project.com/sources/mono/
- Xsp source package: http://download.mono-project.com/sources/xsp/xsp-2.10.2.tar.bz2
2. Compile and install the source code
- The three source code packages downloaded here will be compiled and installed. If the components are missing during installation, you can install them by yourself.
- Some components that need to be used mainly are installed through Yum: Yum install GCC gcc-C ++ glibc-devel glib2
- Compile and install nginx: tar-zxvf nginx-1.2.4.tar.gz
CD nginx-1.2.4/
./Configure
Make & make install
- Compile and install Mono:Tar-jxvf mono-2.11.4.tar.bz2
CD mono-2.11.4/
./Configure -- prefix =/opt/mono-2.11
MakeMake install
Echo export pkg_config_path =/opt/MONO/lib/pkgconfig: $ pkg_config_path> ~ /. Bash_profile
Echo export LD_LIBRARY_PATH =/opt/MONO/lib: $ LD_LIBRARY_PATH> ~ /. Bash_profile
Echo export Path =/opt/MONO/bin: $ PATH >> ~ /. Bash_profile
Source ~ /. Bash_profile
- Install xsp: tar-jxvf xsp-2.10.2.tar.bz2
CD xsp-2.10.2/
./Configure -- prefix =/opt/mono-2.11Make & make install
4. Configure nginx
5. Upload the mvc3 web program (Name: mvctest)
- Use vs2010 to create an mvc3 web program and copy the following referenced DLL to the local system. Data. dll
System. Web. applicationservices. dll
System. Web. dynamicdata. dll
System. Web. helpers. dll
System. Web. MVC. dll
System. Web. Routing. dll
System. Web. webpages. Deployment. dll
System. Web. webpages. dll
System. Web. webpages. Razor. dll
- Manually copy system. Web. Razor. DLL to the directory c: \ Program Files \ Microsoft ASP. NET \ ASP. NET web pages \ V1.0 \ assemblies where the DLL is located in the bin directory
- Upload the program to the nginx web directory (if the directory does not exist)/usr/local/nginx/html/end/
6. test whether the MVC program is executed normally.
- Go to the mvctest directory CD/usr/local/nginx/html/end/mvctest
- Use a browser to test access through port 8080. If it works properly, congratulations! If an error occurs, you must resolve the error before proceeding to the configuration. (Some Common Errors and solutions are listed below)
7. Start nginx and fastcgi_server
- Start nginx/usr/local/nginx/sbin/nginx
- Start fastcgi_serverfastcgi-mono-server4/applications =/:/usr/local/nginx/html/end/mvctest // socket = TCP: 127.0.0.1: 9900/printlog = true
- Fastcgi_server background running method (after a long time running) nohup fastcgi-mono-server4/applications =/:/usr/local/nginx/html/end/mvctest/socket = TCP: 127.0.0.1: 9900/printlog = true &
8. After all the problems are solved, you can run the basic mvc3 program normally ~~
Common Errors and solutions:
- When xsp4 is started, an error is reported. Solution: remove system. Web. dll from the bin directory of the program.
- Badgateway is displayed, and system is reported in the background. typeinitializationexception: An exception was thrown by the Type initializer for mono. webserver. fastCGI. workerrequest -- Solution: Create a prefix in/opt/mono-2.11/bin. sh, and run
#! /Bin/bash
# Your mono directory
Prefix =/opt/mono-2.11
Files = (
'Fastcgi-mono-server4'
'Xsp4 ')
CD $ prefix/lib/MONO/4.0
For file in "$ Files"
Do
CP "cmdfile.exe" ../4.5
Done
CD $ prefix/bin
For file in "$ Files"
Do
Sed-ie's | mono/4.0 | mono/4.5 | G' $ File
Done
- The reported parameter cannot be blank: system. argumentnullexception argument cannot be null. Parameter Name: Key; system. Resources. missingmanifestresourceexception: cocould not find any
Resources appropriate for the specified culture or the neutral
Culture. Make sure "system. Web. MVC. Resources. mvcresources. Resources"
Was correctly embedded or linked into assembly "system. Web. MVC"
Compile time, or that all the satellite assemblies required are
Loadable and fully signed. -- Solution: modify web. config and add
<Globalization uiculture = "en" Culture = "En-us"/>
Database Error:
System. invalidprogramexception: Invalid il code in system. Data. Common. dbpr
Oviderfactories: getfactory (string): Method body is empty.
-- Solution: delete system. Data. dll under bin.