Solved

Ubuntu 9.04 and asp.net error 500

Posted on 2009-07-14
9
776 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 500 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now