سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top