[Mono-list] Mono + Nginx + ASP.NET code-behind files

zipmaster07 jschaeffer0922 at gmail.com
Fri Jul 5 22:09:07 UTC 2013


I'm trying to get a .NET 2.0 web application suite running on Nginx using
Mono.  I get the following error when I try to access the login page (a.k.a.
the home page) at http://tempsite3.com/Goldfish.Web/CSMgr/Login.aspx

===========================================================================
Server Error in '/' Application
------------------------------------------------------------------------------------------------
The section <sessionState> can't be defined in this configuration file (the
allowed definition context is 'MachineToApplication').
(/var/www/paygate.com/Goldfish.Web/CSMgr/Web.config line 16)
------------------------------------------------------------------------------------------------
Description: HTTP 400. Error processing request.
------------------------------------------------------------------------------------------------
Stack Trace:

System.Configuration.ConfigurationErrorsException: The section
<sessionState> can't be defined in this configuration file (the allowed
definition context is 'MachineToApplication').
(/var/www/paygate.com/Goldfish.Web/CSMgr/Web.config line 16)
  at System.Configuration.SectionInfo.ReadData
(System.Configuration.Configuration config, System.Xml.XmlReader reader,
Boolean overrideAllowed) [0x00000] in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader
reader, System.Configuration.Configuration config, Boolean overrideAllowed,
Boolean root) [0x00000] in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadData
(System.Configuration.Configuration config, System.Xml.XmlReader reader,
Boolean overrideAllowed) [0x00000] in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadContent (System.Xml.XmlReader
reader, System.Configuration.Configuration config, Boolean overrideAllowed,
Boolean root) [0x00000] in <filename unknown>:0 
  at System.Configuration.SectionGroupInfo.ReadRootData
(System.Xml.XmlReader reader, System.Configuration.Configuration config,
Boolean overrideAllowed) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader
reader, System.String fileName) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.Load () [0x00000] in <filename
unknown>:0 
  at System.Configuration.Configuration.Init (IConfigSystem system,
System.String configPath, System.Configuration.Configuration parent)
[0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration..ctor
(System.Configuration.InternalConfigurationSystem system, System.String
locationSubPath) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type
typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in
<filename unknown>:0 
  at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration
(System.String path, System.String site, System.String locationSubPath,
System.String server, System.String userName, System.String password,
Boolean fweb) [0x00000] in <filename unknown>:0 
------------------------------------------------------------------------------------------------
Version information: Mono Runtime Version: 2.10.8.1 (Debian 2.10.8.1-8);
ASP.NET Version: 2.0.50727.1433
===========================================================================

I've not found very much about this problem on the web especially dealling
with Nginx

If I comment out the <sessionState> element in my Web.config file then I get
a different error:

...
The section <roleManager> can't be defined in this configuration file (the
allowed definition context is 'MachineToApplication').
(/var/www/paygate.com/Goldfish.Web/CSMgr/Web.config line 18)
...

If I comment out both elements then I don't get any errors but Nginx just
displays the actual text of the login.aspx page, it doesn't use any code
behind:

"This is a marker file generated by the precompilation tool, and should not
be deleted!"

I've also not been able to find much information about what, "the allowed
definition context is 'MachineToApplication'" means

Nginx and Mono are running on Debian Wheezy (latest updates), install
everything from the repos.  Here is the website's Nginx config file:

===========================================================================
server {
	listen 80;

	#server_name	paygate.com *.paygate.com;
	server_name	tempsite3.com *.tempsite3.com;
	root		/var/www/paygate.com;
	index		Login.aspx Home.aspx login.aspx home.aspx index.html;

	access_log	/var/log/nginx/access_paygate.log;
	error_log	/var/log/nginx/error_paygate.log;

	location = /favicon.ico {
		log_not_found	off;
		access_log	off;
	}

	location = robots.txt {
		allow		all;
		log_not_found	off;
		access_log	off;
	}

	location / {
		# This is cool because no php is touched for static content.
		# include the "?$args" part so non-default permalinks do not break when
using query strings
		#try_files	$uri $uri/ /index.php?$args;

		include		fastcgi_params;

		fastcgi_param	PATH_INFO	"";
		fastcgi_param	SCRIPT_FILENAME	$document_root$fastcgi_script_name;

		fastcgi_index	Login.aspx;
		fastcgi_pass	127.0.0.1:9000;
		
	}

	location ~ \.php$ {
		# The "cgi.fix_pathinfo" should be set to 0 in php.ini
		try_files	$uri =404;

		include		fastcgi_params;
			
		fastcgi_pass	unix:/var/run/php5-fpm.sock;
		fastcgi_index	index.php;
	}

	location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
		expires		max;
		log_not_found	off;
	}

	location ~ /\.ht {
		deny	all;
	}
}
===========================================================================

Wordpress is not running for this particular site, I just copied the config
file from a Wordpress site.  Started the Mono server with:

fastcgi-mono-server2 /applications=/:/var/www/paygate.com/
/socket=tcp:127.0.0.1:9000 &

I've also tried starting it with:
-  fastcgi-mono-server2
/applications=/www.tempsite3.com/:/var/www/paygate.com/
/socket=tcp:127.0.0.1:9000 &
-  fastcgi-mono-server2 /applications=/tempsite3.com/:/var/www/paygate.com/
/socket=tcp:127.0.0.1:9000 &

as I've read this worked for some people but saw no change.  No errors show
up in the error log file, the access log file just shows a GET to the page
in question.

Unfortunately I don't have access to the actual code behind files and read
that this is related to a Visual Studio virtual directory issue, and you
have to fix it there.  Does anyone know if this is true?  If not, then is
there a way to fix this issue (to me it looks like it is just not processing
any of the actual code in the .aspx pages).  If so, I guess i'm just out of
luck as I don't think I'll be able to get the actual code, and just have to
run this through IIS.

Thanks



--
View this message in context: http://mono.1490590.n4.nabble.com/Mono-Nginx-ASP-NET-code-behind-files-tp4660114.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list