0

The ServiceStack website has build / install instructions for windows (Nuget). There are many posts referring to mono based ServiceStack, but never any instructions for how to build on Centos for example. I downloaded and built ServiceStack on windows and tried to bring the files over to Centos. So far this has not worked for my integration with mono-fastcgi. I get errors in the browser: "Parser Error Message: Cannot find type ServiceStack.Examples.Host.Web.Global" for example. This particular error is not really my question, unless it can get me further towards a ServiceStack installation that works. The real question is what is the best way to install ServiceStack and build it on Centos? (And getting Nuget to work on Centos is not a solution.. at least I can't get Nuget to build).

After working the steps listed below in discussion with Scott, the nuget.exe command line package manager gets the following errors:

[root@buffer1 nuget]# /usr/local/bin/mono nuget.exe install ServiceStack -Verbosity detailed -ConfigFile /root/nuget/NuGet.config 
WARNING: Invalid certificate received from server. Error code: 0xffffffff800b010a
System.InvalidOperationException: Unable to find package 'ServiceStack'.
  at NuGet.PackageRepositoryHelper.ResolvePackage (IPackageRepository sourceRepository, IPackageRepository localRepository, IPackageConstraintProvider constraintProvider, System.String packageId, NuGet.SemanticVersion version, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0 
  at NuGet.PackageRepositoryHelper.ResolvePackage (IPackageRepository sourceRepository, IPackageRepository localRepository, System.String packageId, NuGet.SemanticVersion version, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0 
  at NuGet.PackageManager.InstallPackage (System.String packageId, NuGet.SemanticVersion version, Boolean ignoreDependencies, Boolean allowPrereleaseVersions) [0x00000] in <filename unknown>:0 
  at NuGet.Commands.InstallCommand.InstallPackage (IFileSystem fileSystem, System.String packageId, NuGet.SemanticVersion version) [0x00000] in <filename unknown>:0 
  at NuGet.Commands.InstallCommand.ExecuteCommand () [0x00000] in <filename unknown>:0 
  at NuGet.Commands.Command.Execute () [0x00000] in <filename unknown>:0 
  at NuGet.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[root@buffer1 nuget]# 

Any ideas on using the command line nuget?

tradetree
  • 354
  • 3
  • 20
  • I was able to use xbuild to build the ServiceStack.Examples (from https://code.google.com/p/servicestack/downloads/list) source on centos 6.4. I finally found a post that mentioned xbuild and that worked. Now I still don't know how to deploy the build, but I'm much closer. – tradetree Feb 21 '14 at 06:30

1 Answers1

2

You mentioned that you have managed to get Mono to build on CentOS.

Don't build ServiceStack from source:

While it is possible, it's unnecessary. You can copy the existing ServiceStack dlls you may have from Windows; you don't need a special build, nor do you have to build them yourself on CentOS.

No Build instructions ... use NuGet:

There aren't specific instructions for building ServiceStack on CentOS, because there aren't instructions for building it from source at all. The recommended approach is to obtain the ServiceStack dlls from NuGet. But you'll only want to do that if you are using the CentOS machine as your development machine. In which case you can download the NuGet command line tool. Then simply run:

mono nuget.exe install ServiceStack

Then in you development IDE (I recommend monodevelop) reference the files that were downloaded by NuGet. See here for instructions on how to get Mono and MonoDevelop running on CentOS.

Invalid Certificate Warning:

This occurs when you haven't added the Mozilla Trusted Root Certificate Providers to the mono trusted providers store. You just need to do this action once, and mono will start trusting SSL certificates from the standard trusted sources:

mozroots --import --sync

See here for more information about Mono SSL Security.

Deploying:

It's just a case of copying your published project to CentOS and following these configuration instructions from the documentation. Except instead of using apt-get to install nginx you will need to use yum. But the configuration of nginx and fastcgi is the same.

Community
  • 1
  • 1
Scott
  • 21,211
  • 8
  • 65
  • 72
  • When I run nuget.exe on Centos I get: Using default runtime v2.0.50727 System.TypeLoadException: Could not load program 'NuGet.Program' from assembly 'NuGet, version = 2.8.50126.400, Culture=neutral, PublicKeyToken=null'. Searching around the web hasn't yielded any solution so far. – tradetree Feb 21 '14 at 15:31
  • @tradetree What version of Mono are you running? `mono --version` – Scott Feb 21 '14 at 15:34
  • @tradetree Are you developing on CentOS? Or you just deploying there? – Scott Feb 21 '14 at 15:35
  • mono version is 2.10.5 on CentOS 6.4. I am developing and deploying on centos, although some of the developing can be done on other machines. I have a win 7, an ubuntu, and centos machines. The reason it must be centos is that the vps provider only supports that OS. – tradetree Feb 21 '14 at 15:39
  • @tradetree I would suggest you use Visual Studio or Xamarin Studio to develop your solution on Windows. Those option have support for NuGet. Then you just copy all the assemblies you need from there. Then you don't have to worry about getting NuGet to work on CentOS. – Scott Feb 21 '14 at 15:43
  • @tradetree However you could try running NuGet on CentOS with the `runtime` option specified. As NuGet need to target .NET 4. Try `mono --runtime=v4.0 nuget.exe install ServiceStack`. 2.10.5 is a rather old version of Mono. – Scott Feb 21 '14 at 15:44
  • The "instructions from the documentation" is out of date. To use the mostlylinux repo you now have to go and get the updated yum repo instructions here: http://mostlylinux.com/tmp/?p=95. Or just go to the mostlylinux.com site and on the right is a link for centos. – tradetree Feb 21 '14 at 15:50
  • Scott. I'll try those suggestions out and report back on the results. The reason I'm using mono 2.10.5 is because it is the only one (mostlylinux) supports for centos. – tradetree Feb 21 '14 at 15:53
  • @tradetree [See here](http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=mono-opt) For straightforward way to install the latest Mono on CentOS. Then [see here](http://software.opensuse.org/download/package?project=home:tpokorra:mono&package=monodevelop-opt) for install of MonoDevelop. These are the latest versions packaged up neatly. – Scott Feb 21 '14 at 16:20
  • Scott, I think those are "mono-opt" not "mono". I did install mono-opt but it is just a browser tool, not mono. I also found xsp server on there, but it still did not have "mono-fastcgi-server4" which I also need. This is supposed to be part of xsp server. – tradetree Feb 21 '14 at 17:32
  • I was able to find a way to build mono from source for CentOS 6.5: http://wiki.phonicuk.com/Installing-Mono-in-CentOS-5-x.ashx I now have version 3.2.8 at least (I changed the target from this tutorial from 2.10.8). – tradetree Feb 21 '14 at 18:03
  • @tradetree The `mono-opt` package is just `mono` the `opt` indicate it installs to the `/opt` path. As for `mono-fastcgi-server4` it is in the package XSP. Does nuget now work for you? – Scott Feb 21 '14 at 18:19
  • Scott, you were correct. Now I have 3 mono installations because I didn't realize it was in /opt. I have the one from mostlylinux using yum, then I have the one from the opensuse.org repo, then I have the one I built from source from the mono project repo. I also have multiple copies of mono-fastcgi-server4. *** Here is a one stop way to get the latest mono, xsp, fastcgi on CentOS: cd /etc/yum.repos.d/ wget http://download.opensuse.org/repositories/home:tpokorra:mono/CentOS_CentOS-6/home:tpokorra:mono.repo yum install xsp *** – tradetree Feb 21 '14 at 18:51
  • Yes, I now can run nuget.exe using mono 3.2.8. But the puzzling thing is that I went to a new machine with centos 6.5 and tried to do the steps again and mono and nuget.exe both work, but fastcgi-mono-server4 fails. It works fine on my other machines. Don't know what's up there, but for now I'll keep going with the working machines. – tradetree Feb 21 '14 at 19:06
  • @tradetree Updated answer to include instructions on the issue will the Invalid Certificate error in NuGet. – Scott Feb 22 '14 at 10:39
  • Scott, I havn't verified your last comment, but I am so much further along that I'm basically there. I have been building in VS and I'll return to mono next. I'll comment further when I have a chance. Thanks for the huge help! – tradetree Feb 23 '14 at 04:17