?
Solved

Ubuntu 9.04 and asp.net error 500

Posted on 2009-07-14
9
Medium Priority
?
816 Views
Last Modified: 2016-03-02
I am building a ubuntu 9.04 server and I want to install asp.net. The sever is working ok and I have installed PHP 5 and this is working OK.  I now want to get ASP.net working.  I have downloaded and installed the packages.  I have run the following commands

sudo apt-get update
sudo apt-get install mono-common mono-vbnc libapache2-mod-mono mono-apache-server2
cd /etc/apache2/
sudo a2enmod mod_mono
sudo a2enmod mod_mono_auto
ln -s /usr/bin/mod-mono-server2 /usr/bin/mod-mono-server
sudo /etc/init.d/apache2 restart

I have created test pages and uploaded them to the website.
However when I try to open the webpage in IE I get a error 500

Server Error in '/' Application

--------------------------------------------------------------------------------

Standard output has not been redirected or process has not been started.
Description: HTTP 500. Error processing request.

Stack Trace:

System.InvalidOperationException: Standard output has not been redirected or process has not been started.
  at System.Diagnostics.Process.CancelErrorRead () [0x00000]
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:CancelErrorRead ()
  at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00000]
  at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00000]
  at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x00000]
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x00000]
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000]
  at System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000]
  at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000]
  at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath (System.String virtualPath, System.Type requiredBaseType) [0x00000]
  at System.Web.UI.PageParser.GetCompiledPageInstance (System.String virtualPath, System.String inputFile, System.Web.HttpContext context) [0x00000]
  at System.Web.UI.PageHandlerFactory.GetHandler (System.Web.HttpContext context, System.String requestType, System.String url, System.String path) [0x00000]
  at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url, Boolean ignoreContextHandler) [0x00000]
  at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url) [0x00000]
  at System.Web.HttpApplication+<Pipeline>c__Iterator2.MoveNext () [0x00000]  

--------------------------------------------------------------------------------
Version information: Mono Version: 2.0.50727.42; ASP.NET Version: 2.0.50727.42

Is anyone here able to help me fix this and get it working.
0
Comment
Question by:DCMBS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24905667
I'm not too acquainted with Ubuntu, but I am quite well acquainted with ASP.NET. Your installation seems to have been fine, otherwise you would not receive this error, which is in the style of a properly caught error which is then shown to the user. The 500-type is normal for any internal server error (i.e., if you have some programming error).

The 0x0000 behind each stacktrace line seem to mean that the line numbers are not available. You may try the same with a debug build to see the line numbers.

The actual error you get seems to imply that you are writing something to stdio, which can happen when you use Console.Write or even Debug.Write. Yet, when inside a web request, the default output should be set to the HttpOutputStream. That you get an error that the standard output has not been redirected seems to imply that the stdio is not set to the webio.

To resolve this error, you should check some of the asp.net documentation for mono, it may say something about how you can redirect the standard output in your asp.net process.

-- Abel --
0
 
LVL 39

Expert Comment

by:abel
ID: 24905679
PS: in the code that would probably look like Response.Write or similar.
0
 
LVL 39

Expert Comment

by:abel
ID: 24905853
As an alternative, you may consider installing NeoKernel to run your app. It may or may not resolve your issue, but it may save you some setting up problems: http://www.neokernel.com/content.agent?page_name=Home (click the Mono version).
0
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 
LVL 9

Author Comment

by:DCMBS
ID: 24906544
Thanks

The test page generating the error was a simple hello world page

<% HelloWorldLabel.Text = "Hello World!"; %>
<html>
  <body>
    <form id="form1" runat="server">
      <asp:Label runat="server" id="HelloWorldLabel" />
    </form>
  </body>
</html>
0
 
LVL 39

Expert Comment

by:abel
ID: 24906702
Any page will have, without you knowing, the Response.Write inside it. That's the "default output" for a web page which is used to write the rendered contents to.

Indeed, the code above itself will not throw that error. Instead, the Render method of the Page object or the Label object or both.. However, a bit of research and googling gave me that this particular error seems to come from the spawning of a new process (Process.Start and the like). In general, a web page does not need a specific process, instead, it runs in the IIS/'Apache/PWS process.

From your text above I don't see whether you installed Mono as well, but I assume, from the error (which comes from Mono) that you have. If you use an old version, you may try to upgrade, but I doubt it will help.

The error you get comes from the CSharp compiler of Mono. It is said that the C# compiler is very mature, and the VB compiler is not, nevertheless, you may try the following (don't forget to change the language setting in your web.config) (I know, it is almost the same):

<% HelloWorldLabel.Text = "Hello World!" %>
<html>
  <body>
    <form id="form1" runat="server">
      <asp:Label runat="server" id="HelloWorldLabel" />
    </form>
  </body>
</html>

Open in new window

0
 
LVL 39

Accepted Solution

by:
abel earned 2000 total points
ID: 24906782
Actually, this may be it:

There's a bug in the mono 2 installer that neglects to create a required symbolic link for the newer c# compiler. If you install monodevelop then all is fine but if you just want to run Mono based apps without the IDE on a box you hit the issue.
which makes sense in your situation. You can find the solution on how to fix this symbolic link issue here: http://www.smithvoice.com/ubuntu-810-server-mono-configuration.aspx (read on to Ubuntu 9.04 tip).

Alternatively, you can install MonoDevelop, which also fixes the issue it seems.

-- Abel --
0
 
LVL 9

Author Comment

by:DCMBS
ID: 24908839
Unfortunately I have had to revert to a previous verion of the site that uses PHP as this site needs to go live.  I willl have to build a different server and try to get this fixed so that the site can be updated.  I will keep the above in mind when I am building the new server and post back when I have some progress.

Many Thanks

0
 
LVL 9

Author Closing Comment

by:DCMBS
ID: 31603216
I haven't had a chance to do this on gthe live server and it has now gone on the back burner as the site developer is porting to windows.  
0
 
LVL 39

Expert Comment

by:abel
ID: 25056014
Tx for checking back, I see you're going over to windows (grading comment) which may be easier for this type of development. However, if ever you need this on Ubuntu and you manage to get it to work with this fix, would you care to update here?
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question