Ubuntu 9.04 and asp.net error 500

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.
LVL 9
DCMBSAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

abelCommented:
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
abelCommented:
PS: in the code that would probably look like Response.Write or similar.
0
abelCommented:
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
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

DCMBSAuthor Commented:
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
abelCommented:
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
abelCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DCMBSAuthor Commented:
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
DCMBSAuthor Commented:
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
abelCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.