{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Home/issues/410","repository_url":"https://api.github.com/repos/Starcounter/Home","labels_url":"https://api.github.com/repos/Starcounter/Home/issues/410/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Home/issues/410/comments","events_url":"https://api.github.com/repos/Starcounter/Home/issues/410/events","html_url":"https://github.com/Starcounter/Home/issues/410","id":320239088,"number":410,"title":"Tests with database access crash starcounter service","user":{"login":"gsimion","id":11250291,"avatar_url":"https://avatars0.githubusercontent.com/u/11250291?v=4","gravatar_id":"","url":"https://api.github.com/users/gsimion","html_url":"https://github.com/gsimion","followers_url":"https://api.github.com/users/gsimion/followers","following_url":"https://api.github.com/users/gsimion/following{/other_user}","gists_url":"https://api.github.com/users/gsimion/gists{/gist_id}","starred_url":"https://api.github.com/users/gsimion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsimion/subscriptions","organizations_url":"https://api.github.com/users/gsimion/orgs","repos_url":"https://api.github.com/users/gsimion/repos","events_url":"https://api.github.com/users/gsimion/events{/privacy}","received_events_url":"https://api.github.com/users/gsimion/received_events","type":"User","site_admin":false},"labels":[{"id":568581296,"url":"https://api.github.com/repos/Starcounter/Home/labels/bug","name":"bug","color":"e6194b","default":true},{"id":676492969,"url":"https://api.github.com/repos/Starcounter/Home/labels/hosting","name":"hosting","color":"008080","default":false},{"id":676492970,"url":"https://api.github.com/repos/Starcounter/Home/labels/hosting-unit-test","name":"hosting-unit-test","color":"008080","default":false},{"id":676493024,"url":"https://api.github.com/repos/Starcounter/Home/labels/investigate","name":"investigate","color":"ffff00","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-04T11:22:07Z","updated_at":"2018-05-07T07:43:29Z","closed_at":null,"author_association":"NONE","body":"Version: 2.4.0.6025.\r\nI am experiencing problems when running the tests with database access while the starcounter service is running as local service. The tests have been written following the [documentation ](https://docs.starcounter.io/v/2.4/how-to-guides/how-to-write-tests-with-database-access) available translated to a NUnit context. \r\n```\r\n// Start server to interact with host \r\n// Stop host in case a database is already running\r\n// Recreate the database to start clean\r\n_cli = new StarAdminCli(Properties.Settings.Default.TestDbInstance);\r\n_cli.StartServer()\r\n                .StopHost()\r\n                .RecreateDatabase(<PORT>);\r\n\r\n// Load the database into the app host and\r\n// point to the assembly to test\r\n_host = new AppHostBuilder()\r\n                .UseDatabase(<NAME>)\r\n                .UseApplication(typeof(<APP>).Assembly)\r\n                .Build();\r\n            \r\n_host.Start();\r\n```\r\nI am running with full administrator credentials. When running tests without lunching the service first (i.e. service.exe, scnetworkgateway.exe, etc running as Admin) the tests go through without any problem.\r\n\r\n**Procedure to reproduce**:\r\n\r\n1. Services -> Starcounter Server Service -> start\r\n2. Run tests with admin credentials\r\n\r\n**Expected behavior**: \r\n\r\n- Test execution\r\n\r\n**Actual behavior**: \r\n\r\n- New scnetworkgateway.exe process created running as local service\r\n- The newly created process collides the existing one, resulting in a full Starcounter service crash\r\n- Exception occurs in `_host.Start()`\r\n\r\nException message:\r\nMessage: OneTimeSetUp: System.AggregateException : One or more errors occurred.\r\n  ----> System.Net.Http.HttpRequestException : An error occurred while sending the request.\r\n  ----> System.Net.WebException : The underlying connection was closed: An unexpected error occurred on a receive.\r\n  ----> System.IO.IOException : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.\r\n  ----> System.Net.Sockets.SocketException : An existing connection was forcibly closed by the remote host\r\n\r\nEvent log:\r\nFaulting application name: scnetworkgateway.exe, version: 0.0.0.0, time stamp: 0x5ae70818\r\nFaulting module name: ucrtbase.dll, version: 10.0.16299.248, time stamp: 0xe71e5dfe\r\nException code: 0xc0000409\r\nFaulting application path: C:\\Program Files\\Starcounter\\scnetworkgateway.exe\r\nFaulting module path: C:\\Windows\\System32\\ucrtbase.dll\r\nThe Starcounter Server Service service terminated unexpectedly.\r\n"},"comment":{"url":"https://api.github.com/repos/Starcounter/Home/issues/comments/386985664","html_url":"https://github.com/Starcounter/Home/issues/410#issuecomment-386985664","issue_url":"https://api.github.com/repos/Starcounter/Home/issues/410","id":386985664,"user":{"login":"miyconst","id":6435556,"avatar_url":"https://avatars3.githubusercontent.com/u/6435556?v=4","gravatar_id":"","url":"https://api.github.com/users/miyconst","html_url":"https://github.com/miyconst","followers_url":"https://api.github.com/users/miyconst/followers","following_url":"https://api.github.com/users/miyconst/following{/other_user}","gists_url":"https://api.github.com/users/miyconst/gists{/gist_id}","starred_url":"https://api.github.com/users/miyconst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyconst/subscriptions","organizations_url":"https://api.github.com/users/miyconst/orgs","repos_url":"https://api.github.com/users/miyconst/repos","events_url":"https://api.github.com/users/miyconst/events{/privacy}","received_events_url":"https://api.github.com/users/miyconst/received_events","type":"User","site_admin":false},"created_at":"2018-05-07T07:43:29Z","updated_at":"2018-05-07T07:43:29Z","author_association":"OWNER","body":"@per-samuelsson this is quite important, but I will first setup the test environment and try to reproduce it."}}
{"actor":{"display_login":"miyconst"}}