Reputation: 107
I am trying to setup a NuGet gallery on Linux using Mono on Apache. I'm running into what seems like a typical error:
Error deserializing configuration section compilation: Unrecognized attribute 'targetFramework'. (/app/www/nugetsrus.sys.company.net/Web.config line 1).
However every workaround I've tried doesn't work. I am NOT running xsp4
I'm on CentOS 6.1 with Mono 3.2.6
I built an empty .NET 4.0 web app in VS 2012 and added the nuget.server to it. Built and published and it works in IIS. I copied the folder to my CentOS box and configured Apache and Mono as best as I could.
I have ensured that I have User apache and group apache before my Include conf.d/*.conf If I remove the targetFramework 4.0 line from the Web.config I get an Internal Server Error
No idea what else to do or look at here to make mono run a .NET 4.0 app.
Upvotes: 1
Views: 1094
Reputation: 107
Well I fixed it. A very small configuration issue was the problem. Apparently by default the mod-mono-server2 runs even if you specify the mod-mono-server4 in your mod_mono.conf file. You have to specify mod-mono-server4 in the Apache config file for the web site you are trying to run.
I was overlooking the text at the bottom of the error that indicated that mono was running ASP.NET 2.0.50727.1433. Since my web app was built in .NET 4.0, obviously you'd get a framework error since 2.0 doesn't know about that attribute. That's because mod-mono-server2 was running. I had to force mod-mono-server4 to run.
Here is what the relevant part of my Nuget.conf file looks like:
<VirtualHost *:80>
DocumentRoot /app/www/nugetsrus.sys.company.net
MonoDebug nugetsrus.sys.company.net true
MonoSetEnv nugetsrus.sys.company.net MONO_IOMAP=all
MonoApplications nugetsrus.sys.company.net "/:/app/www/nugetsrus.sys.company.net"
MonoServerPath nugetsrus.sys.company.net /opt/mono/bin/mod-mono-server4
The last line is what was the key to making it work. I initually just had: MonoServerPath /opt/mono/bin/mod-mono-serve4, but it was explicitly putting the name of the app in between that made it run server4 instead of server2, and thus .NET 4.0 instead of 2.0
Now, it works most of the time. If I restart Apache, the first attempted browse it fails. After that, it's fine. Very weird.
Upvotes: 1