Deploy ServicesStack (.Net Core) in Nginx

Hi, I am publish web application in linux from this instruction: https://docs.asp.net/en/latest/publishing/linuxproduction.html#id5

But is nor work after first clicking on the link.

main link: http://109.120.187.38/
ss link: http://109.120.187.38/metadata

Based on: https://github.com/NetCoreApps/Todos

log:

Help please, how to deploy ServiceStack in linux width Nginx, there are instructions?

Thanks!

Is application working if you access it without nginx? Logs say that it crashes everytime. Did you make any changes in original todos application? If yes, can you run original Todos and see if the crash is happens again.

So, need to check the following:

  1. Try to run application without nginx. Check if it crashes with SIGSEGV.
  2. If application crashes without nginx try to run original Todos application. Check if it crashes with SIGSEGV.
  3. If it does crashes please say which environment (OS, .NET Core version, docker container or host) you use. If you try to run application in non-privileged docker container this setting might help

VPS host

OS:
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie

.Net Core
1.0.0-preview2-003131
(its a last in microsoft)

Original Todos app doesn’t worked to without Nginx.
I start web app in this command: dotnet run

When you type dotnet run what is the output do you see? When did application crash: when you start it or when you open url with browser?

So better to be seen :blush:

OK, as I see it crashes on calling /todos service. Do you have redis installed on this machine? Which version? is it accessible via telnet localhost 6379 command?

Redis run on service, it work:

the same mistake can get if you change the code on such:

public object Any(Todo todo){
	return "test";
}

Did you try to add IPAddressExtensions.AccessNetworkInterface = false; at the startup of the program? Does it affect on the code running on your machine?

No, I have not tried to add, and where I add this code?

It’s a setting of static variable, you can add this at Main() before creating host vith var host = new WebHostBuilder().

I understand, I just don’t have in the Assembly of this field:

I have

from GitHub

Where can I get the latest build?

Ah, it’s not pushed to nuget yet. Should be pushed soon, but we can check before release will be available is this a case of your error or something another. Try to create new .NET Core app with dotnet new and execute following code.

using System;
using System.Net.NetworkInformation;

public class Program
{
    public static void Main()
    {
        try
        {
            NetworkInterface.GetAllNetworkInterfaces();
        }
        catch
        {
            Console.WriteLine("caught");
        }
    }
} 

The project.json should look like this

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.1"
        },
        "System.Net.NetworkInformation" : "4.1.0"
      },
      "imports": "dnxcore50"
    }
  }
}

If you will see Caught in the console output, then this is not your case and need to find a way to isolate the issue. If you see exception without Caugth word then the setting mentioned above should help in your case (when 1.0.24 version will be deployed on nuget)

No error but get strange result:

there may be a problem in the platform?

events work fine, so something is wrong with the module System.Net.NetworkInformation:

The latest ServiceStack packages v1.0.24 are deployed on Nuget, so you can use it and set IPAddressExtensions.AccessNetworkInterface = false; at the start to avoid this .NET Core error. By the way, it should be fixed in .NET Core 1.1 release.

Set the value: IPAddressExtensions.AccessNetworkInterface = false;
and the service started working!

Thanks a lot !!! :smiley:

1 Like

Great! Happy using ServiceStack on .NET Core :smile: